diff --git a/example.py b/example.py new file mode 100644 index 0000000..a84392d --- /dev/null +++ b/example.py @@ -0,0 +1,18 @@ +import wideq + + +def example(): + gw = wideq.gateway_info() + oauth_base = gw['empUri'] + api_root = gw['thinqUri'] + print(wideq.oauth_url(oauth_base)) + + access_token = wideq.parse_oauth_callback(input()) + print(access_token) + + session_info = wideq.login(api_root, access_token) + print(session_info) + + +if __name__ == '__main__': + example() diff --git a/wideq.py b/wideq.py index 4cdb2fa..d9ce318 100644 --- a/wideq.py +++ b/wideq.py @@ -60,6 +60,7 @@ def login(api_root, access_token): """Use an access token to log into the API and obtain a session and return information about the session. """ + url = urljoin(api_root + '/', LOGIN_PATH) req_data = {DATA_ROOT: { 'countryCode': COUNTRY,