Python requests-oauthlib - adding parameters to authorization header for Oauth1 request

559 views Asked by At

In my Flask App, I'm using the Python requests-oauthlib library to make OAuth1 requests (https://requests-oauthlib.readthedocs.io/en/latest/oauth1_workflow.html#). One of the API calls that I need to make require passing the 'diffie_hellman_challenge' parameter in the authorization header. From the documentation, I do not see anything about adding custom parameters to the authorization header. Is there a way or another OAuth1 library that I can use to add a custom parameter? My code is as follows:

 from requests_oauthlib import OAuth1

 headeroauth = OAuth1(oauth_consumer_key, signature_method='RSA-SHA256', rsa_key=private_signing_key, signature_type='auth_header', diffie_hellman_challenge=dhChallenge)

 response = requests.post(url, auth=headeroauth)

Unfortunately, the server responds with the following error:

 TypeError: __init__() got an unexpected keyword argument 'diffie_hellman_challenge'
0

There are 0 answers