forked from HannahMR/tapd-python-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.py
23 lines (16 loc) · 580 Bytes
/
list.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import requests
import codecs
from settings import REST_HOST, MACAROON_PATH, TLS_PATH
def main():
url = f"https://{REST_HOST}/v1/taproot-assets/assets"
macaroon = codecs.encode(open(MACAROON_PATH, "rb").read(), "hex")
headers = {"Grpc-Metadata-macaroon": macaroon}
data = {}
response = requests.get(url, headers=headers, verify=TLS_PATH)
if response.status_code == 200:
response_data = response.json()
print("Response from tapd:", response_data)
else:
print("Error:", response.text)
if __name__ == "__main__":
main()