mirror of
https://github.com/no2chem/wideq.git
synced 2025-05-16 15:20:09 -07:00
Move smoke test to its own file
This commit is contained in:
parent
6a2f4321d3
commit
009ed8e330
18
example.py
Normal file
18
example.py
Normal file
@ -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()
|
1
wideq.py
1
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
|
"""Use an access token to log into the API and obtain a session and
|
||||||
return information about the session.
|
return information about the session.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
url = urljoin(api_root + '/', LOGIN_PATH)
|
url = urljoin(api_root + '/', LOGIN_PATH)
|
||||||
req_data = {DATA_ROOT: {
|
req_data = {DATA_ROOT: {
|
||||||
'countryCode': COUNTRY,
|
'countryCode': COUNTRY,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user