Skip to content

Instantly share code, notes, and snippets.

@dmytrostriletskyi
Created March 26, 2024 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmytrostriletskyi/769b2a787bcda804d42baa80016423a0 to your computer and use it in GitHub Desktop.
Save dmytrostriletskyi/769b2a787bcda804d42baa80016423a0 to your computer and use it in GitHub Desktop.
# current_timestamp = str(int(datetime.datetime.now().timestamp()))
# url = f'https://api.arkhamintelligence.com/portfolio/entity/{entity}'
def generate_headers(current_timestamp, host):
API_HOST = 'https://api.arkhamintelligence.com'
CLIENT_KEY = 'gh67j345kl6hj5k432'
path = host.replace(API_HOST, '').split('?')[0]
hash_ = hashlib.sha256(f"{path}:{current_timestamp}:{CLIENT_KEY}".encode()).hexdigest()
x_payload = hashlib.sha256(f"{CLIENT_KEY}:{hash_}".encode()).hexdigest()
headers = {
'authority': 'api.arkhamintelligence.com',
'accept': 'application/json, text/plain, */*',
'accept-language': 'en-US,en;q=0.9,ru;q=0.8,uk;q=0.7,la;q=0.6,bg;q=0.5',
'authorization': TOKEN,
'origin': 'https://platform.arkhamintelligence.com',
'referer': 'https://platform.arkhamintelligence.com/',
'sec-ch-ua': '"Not A(Brand";v="99", "Google Chrome";v="121", "Chromium";v="121"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"macOS"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-site',
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36',
'x-payload': x_payload,
'x-timestamp': current_timestamp,
}
return headers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment