Python Twitter Api: AttributeError: module 'twitter' has no attribute 'trends'
Question: 
    import twitter
    import json
    
    
    
    OAUTH_TOKEN='aaa'
    OAUTH_SECRET='bbb'
    CONSUMER_KEY='ccc'
    CONSUMER_SECRET='ddd'
    
              auth=twitter.oauth.OAuth(OAUTH_TOKEN,OAUTH_SECRET,CONSUMER_KEY,CONSUMER_SECRET)
    twitter_api=twitter.Twitter(auth=auth)
    
    
    print(twitter_api)
    
    
    
    
    WORLD_WOE_ID=1
    world_trends=twitter.trends.place(_id=WORLD_WOE_ID)
    print(world_trends)
    

I always get the error: `AttributeError: module 'twitter' has no attribute
'trends'`


Answer: You have to call `.trends` on an instance of `Twitter` instead of the module.
This should work for you:

    
    
    import twitter
    import json 
    
    OAUTH_TOKEN='aaa'
    OAUTH_SECRET='bbb'
    CONSUMER_KEY='ccc'
    CONSUMER_SECRET='ddd'
    auth=twitter.oauth.OAuth(OAUTH_TOKEN,OAUTH_SECRET,CONSUMER_KEY,CONSUMER_SECRET)
    twitter_api=twitter.Twitter(auth=auth)    
    
    print(twitter_api)   
    
    WORLD_WOE_ID=1
    world_trends=twitter_api.trends.place(_id=WORLD_WOE_ID)
    print(world_trends)
    

