-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathexample.py
More file actions
32 lines (25 loc) · 785 Bytes
/
example.py
File metadata and controls
32 lines (25 loc) · 785 Bytes
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
import twentyi_api
auth = {
"bearer": "yourtokengoeshere",
# "username": "absolutely@thebestemail.net",
# "password": "SuperSecurePassword"
}
twentyi = twentyi_api.TwentyIRestAPI(auth=auth)
domains = twentyi.get("/domain")
packages = twentyi.get("/package")
layout = "{:<40}{:<10}"
print(layout.format("Domain name", "ID"))
print("{:=<40}{:=>10}".format("=", "="))
for domain in domains:
print(layout.format(domain["name"], domain["id"]))
print()
layout = layout+"{:<30}"
print(layout.format("Package name", "ID", "Type"))
print("{:=<40}{:=>10}{:=>30}".format("=", "=", "="))
for package in packages:
print(layout.format(
package["name"],
package["id"],
package["packageTypeName"]
))
twentyi.post("/domain/example.com/claimName")