-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathauth_check_example.py
More file actions
38 lines (28 loc) · 1.19 KB
/
auth_check_example.py
File metadata and controls
38 lines (28 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
This file is a part of signNow SDK API client.
(c) Copyright © 2011-present airSlate Inc. (https://www.signnow.com)
For more details on copyright, see LICENSE.md file
that was distributed with this source code.
"""
from signnow.api.auth.request import TokenGetRequest
from signnow.api.auth.response import TokenGetResponse
from signnow.core.api_client import ApiClient
from signnow.core.exception import SignNowApiException
from signnow.core.factory import SdkFactory
from preset_data import PRESET_BEARER_TOKEN
def main():
"""Main function to demonstrate token check."""
bearer_token = PRESET_BEARER_TOKEN
try:
client: ApiClient = SdkFactory.create_api_client_with_bearer_token(bearer_token)
response: TokenGetResponse = client.send(TokenGetRequest()).get_response()
print(f"Token type: {response.token_type}")
print(f"Token: {response.access_token}")
print(f"Type: {response.token_type}")
print(f"Scope: {response.scope}")
print(f"Expires at: {response.expires_in}")
except SignNowApiException as e:
print("Exception when signNow API call TokenGetRequest")
print(f"ERROR: {e}")
if __name__ == "__main__":
main()