简体   繁体   中英

API GET request fails with custom headers

I have this API GET request that works fine with the full address:

# Transactions
transaction_url = "https://api.whale-alert.io/v1/transaction/ethereum/0015286d8642f0e0553b7fefa1c168787ae71173cbf82ec2f2a1b2e0ffee72b2"
transaction_querystring = {
    "api_key":"APIKEY"
    }

transaction_response = requests.request("GET", transaction_url, params=transaction_querystring)
print(transaction_response)
print(transaction_response.text)

but, when I try to pass the variables as headers:

# Transactions
transaction_url = "https://api.whale-alert.io/v1/transaction"

transaction_querystring = {
    "api_key":"APIKEY"
    }
    
transaction_headers = {
    'blockchain': "ethereum",
    'hash': "0015286d8642f0e0553b7fefa1c168787ae71173cbf82ec2f2a1b2e0ffee72b2"
    }

transaction_response = requests.request("GET", transaction_url, headers=transaction_headers, data=transaction_querystring, )
print(transaction_response)
print(transaction_response.text)

It won't work:

<Response [404]

Not Found

使其与{0}".format(startime_unix)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM