All checks were successful
Build Docker / BuildImage (push) Successful in 47s
43 lines
964 B
Python
43 lines
964 B
Python
import requests
|
|
import os
|
|
import dotenv
|
|
|
|
dotenv.load_dotenv()
|
|
|
|
HSD_IP = '127.0.0.1'
|
|
HSD_PORT = 12037
|
|
HSD_API_KEY = ''
|
|
|
|
if os.getenv("HSD_IP"):
|
|
HSD_IP = os.getenv("HSD_IP")
|
|
|
|
if os.getenv("HSD_PORT"):
|
|
HSD_PORT = os.getenv("HSD_PORT")
|
|
|
|
if os.getenv("HSD_API_KEY"):
|
|
HSD_API_KEY = os.getenv("HSD_API_KEY")
|
|
|
|
HSD_URL = f'http://x:{HSD_API_KEY}@{HSD_IP}:{HSD_PORT}'
|
|
|
|
if os.getenv("HSD_URL"):
|
|
HSD_URL = os.getenv("HSD_URL")
|
|
|
|
|
|
print(f"Using HSD_URL: {HSD_URL}")
|
|
|
|
def get_tx(txid):
|
|
return requests.get(f"{HSD_URL}/tx/{txid}").json()
|
|
|
|
def get_block(blockhash):
|
|
return requests.get(f"{HSD_URL}/block/{blockhash}").json()
|
|
|
|
|
|
def get_name(name):
|
|
return requests.post(HSD_URL, json={"method": "getnameinfo", "params": [name]}).json()
|
|
|
|
def get_name_resource(name):
|
|
return requests.post(HSD_URL, json={"method": "getnameresource", "params": [name]}).json()
|
|
|
|
|
|
def get_address(address):
|
|
return requests.get(f"{HSD_URL}/tx/address/{address}").json() |