-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtantrum_shell.py
42 lines (31 loc) · 1.2 KB
/
tantrum_shell.py
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
39
40
41
42
#!python -i
# import time
import urllib3
import tantrum
import tantrum_creds
# disable requests warnings about SSL cert issues
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# add a log that goes to STDERR for debug level and above
tantrum.utils.logs.add_stderr(lvl="info")
# setup an HTTP client for communicating with the server
http_client = tantrum.http_client.HttpClient(
url=tantrum_creds.url, verify=False, lvl="debug"
)
# setup an authentication method that uses an http client to send auth requests
auth_method = tantrum.auth_methods.Credentials(
http_client=http_client,
username=tantrum_creds.username,
password=tantrum_creds.password,
lvl="debug",
)
# setup an API client that uses an http client to send API requests
api_client = tantrum.api_clients.Soap(
http_client=http_client, auth_method=auth_method, lvl="debug"
)
# setup an API objects layer
api_objects = tantrum.api_objects.load()
# setup an adapter that uses an API client and API objects to send commands to the API
adapter = tantrum.adapters.Soap(
api_client=api_client, api_objects=api_objects, lvl="debug"
)
# Now you can use an adapter directly, or use a workflow that uses an adapter.