Created
February 20, 2020 16:31
-
-
Save nichotined/8dd4fe317fb8811c235b38a7ece00ba0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from API import Get, Post | |
import requests | |
class Login(Post): | |
def __init__(self, phone_number: str): | |
super().__init__() | |
self.url = "https://somedomain.com/login" | |
self.headers = { | |
"Content-Type": "application/json" | |
} | |
self.json = { | |
"phone_number": phone_number | |
} | |
self.execute() | |
class VerifyOtp(Post): | |
def __init__(self, otp: str): | |
super().__init__() | |
self.url = "https://somedomain.com/verify_otp" | |
self.headers = { | |
"Content-Type": "application/json" | |
} | |
self.json = { | |
"otp": otp | |
} | |
self.execute() | |
if __name__ == "__main__": | |
login = Login("8123456789") | |
assert login.response.ok | |
verify_otp = VerifyOtp(login.json_object.otp) | |
assert verify_otp.response.ok | |
assert verify_otp.json_object.token is not None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment