I’m not sure what i’m doing wrong with the script below, but i keep getting this error when i try to execute the script. any idea what i’m doing wrong? thanks!

import requests
blxr_endpoint = "https://bxgw-nd-061-866-537.p2pify.com"
authorization = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
blxr_request_json = {
"method": "blxr_tx",
"params": {
"transaction": signed_txn.rawTransaction.hex()[2:],
}
}
result = requests.post(blxr_endpoint,json = blxr_request_json,auth = authorization)
Advertisement
Answer
Less familiar with the auth param , but from requests docs the auth param doesn’t get string as an input.
It supposed to get a class that inherits from requests.auth.AuthBase like:
HTTPBasicAuth
HTTPDigestAuth
OAuth1
and other(you can also create one yourself.)
Another option is to insert the Authorization header of the http manually:
result = requests.post(blxr_endpoint, headers={'Authorization': authorization})