question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError: 'module' object has no attribute 'Consumer'

See original GitHub issue

I tried to use oauth library for my application, that will parse tweets from an account, used instructions from here https://dev.twitter.com/oauth/overview/single-user:

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

def get_tweets():
    timeline = oauth_req('https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=climagic', '3WTohSoXhJrmmk61oOwmJBwQp', 'FlqER9N3qoYl89bPTZ8EP9CWXBtttkikaYeE9pqIyCwX7GSNYA' )
    print(timeline)

But it doesn’t work because of absence of attribute ‘Consumer’.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
sla-shicommented, Feb 27, 2019

pip install oauth2 solved the problem for me.

0reactions
RyanTanjayacommented, May 21, 2020

i’ve downloaded it and replaced it, but it says ModuleNotFoundError: No module named ‘oauth2._compat’

Read more comments on GitHub >

github_iconTop Results From Across the Web

How should I use Consumer object in oauth2 v.2 in Python 3.4?
There is some problem with default installation of oauth2 using pip install oauth2 . Right now I tried it on both Python 2.7...
Read more >
OAuth2 + Twitter 'module' object has no attribute 'Consumer ...
AttributeError : 'module' object has no attribute 'Consumer' I've tried including the oauth2 module in web2py/sites-package and myapp/modules and still get ...
Read more >
AttributeError: 'module' object has no attribute 'Consumer' - Trac
How to Reproduce. While doing a POST operation on /admin/spamfilter/external , Trac issued an internal error. I added public / private keys for...
Read more >
SALT AttributeError: 'module' object has no attribute 'dockermod'
The error is due to AttributeError: 'module' object that has no attribute 'dockermod'. This is due to a known and fixed regression in...
Read more >
Attributeerror: 'Module' Object Has No Attribute ... - ADocLib
Module isn't properly installed. Check your sitepackages folder for the module. Not running with an appropriate version of Python i.e. installing modules meant....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found