Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8605441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:49:55+00:00 2026-06-12T02:49:55+00:00

I have been pounding my head against the wall over figuring out how to

  • 0

I have been pounding my head against the wall over figuring out how to send authenticated requests with oauth.

I was able to get access tokens, but wasn’t entirely sure how to submit a request with them. I found this on twitter’s developer’s information:

https://dev.twitter.com/docs/auth/oauth/single-user-with-examples#python
which has some example code for sending an authorized request:

def oauth_req(url, key, secret, http_method="GET", post_body=None,http_headers=None):
    consumer = oauth.Consumer(key=consumerKey, secret=consumerSecret)
    token = oauth.Token(key=tokenKey, secret=tokenSecret)
    client = oauth.Client(consumer, token)
    resp, content = client.request(
        url,
        method=http_method,
        body=post_body,
        headers=http_headers,
        #force_auth_header=True                                                                                                                                                 
        )
    return resp,content

oauth_req('http://openapi.etsy.com/v2/shops/:user/transactions',tokenKey,tokenSecret)

However, when I included all of my information, I received the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/python-22060Umg.py", line 153, in <module>
    transactions = oauth_req('http://openapi.etsy.com/v2/shops/:user/transactions',tokenKey,tokenSecret)
  File "/tmp/python-22060Umg.py", line 76, in oauth_req
    force_auth_header=True
TypeError: request() got an unexpected keyword argument 'force_auth_header'

where :user is the actual user (I’ve removed it from the post) and tokenKey/tokenSecret are the access tokens.

I thought perhaps it was as simple as commenting out the offending line, but no such luck:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/python-22060hwm.py", line 153, in <module>
    transactions = oauth_req('http://openapi.etsy.com/v2/shops/:user/transactions',tokenKey,tokenSecret)
  File "/tmp/python-22060hwm.py", line 75, in oauth_req
    headers=http_headers
  File "/usr/lib/python2.7/dist-packages/oauth2/__init__.py", line 662, in request
    req.sign_request(self.method, self.consumer, self.token)
  File "/usr/lib/python2.7/dist-packages/oauth2/__init__.py", line 493, in sign_request
    self['oauth_body_hash'] = base64.b64encode(sha(self.body).digest())
TypeError: must be string or buffer, not None

So now, stackoverflow, you are my only hope! Anyone has suggestions for how to use my access token to submit a request?

thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T02:49:57+00:00Added an answer on June 12, 2026 at 2:49 am

    Twitter’s documentation is out of date — the version of oauth2 they link to is a 3-year-old fork. There is no keyword argument force_auth_header anymore for oauth2.Client.request

    The reason why you still get errors even after removing the offending line is because your default value for post_body is None which gets passed straight through to oauth2.Client.request. You won’t be able to do that in practice. You’ll either have to require that argument, pick a default value that works (e.g an empty string), or check before you pass it through to prevent this error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been pounding my head against a wall trying to figure out what
I've been pounding my head on the wall trying to figure out how to
Have been playing around with instruments with not much luck in figuring out how
Have been getting pretty bald over this situation! I am using MS VS 2010
have been able to output images from BLOB, however I am now wanting to
Have been trying the whole day long and googled the **** out of the
have been working and wearing out my fingers doing google searches with this one:
Have been pulling out my hair trying to find out why my sessions are
I have been looking all over for how to compare char elements in a
I'm pounding my head against this. Once every 5-10 times I reload my app,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.