ok some spooky action from python here... I set headers to something but it forces it to python-requests.
import requests, secrets, hashlib
import treasure
def send_post_request(url, data, header):
response = requests.post(url, data, header)
return response
scope = "account:stashes"
base64_encoded_privkey = secrets.token_bytes(32)
base64_encoded_pubkey = hashlib.sha256(base64_encoded_privkey).digest()
header = {'Content-Type': 'application/x-www-form-urlencoded'
,'User-Agent':'OAuth ' + treasure.client_id +"/"+ treasure.version + " (contact: " + treasure.contact+")"
}
API_token_endpoint = "https://pathofexile.com/oauth/token"
request_data = {"client_id":treasure.client_id
,"client_secret":treasure.client_secret
,"grant_type":"client_credentials"
,"scope":scope
}
if __name__ == '__main__':
response = send_post_request(API_token_endpoint,request_data, header)
print(response.request.headers)
print(response)
output:
{'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Length': '107', 'Content-Type': 'application/x-www-form-urlencoded'}
<Response [403]>