Twitter data with python

Asked

Viewed 311 times

2

Hello. I want to mine twitter data using python. I started doing an initial example, but it’s giving error.

I imported twitter_python to the python lib folder 3.6 via the setupe.py install command at the windows prompt. The code:

import twitter  
api=twitter.Api()  

statuses=api.GetPublicTimeline()  

print(s.user.name for s in statuses)  

Follow the error https://uploaddeimagens.com.br/imagens/erro-jpg--521

follows the folder site package:
https://uploaddeimagens.com.br/imagens/estruturas_da_pasta_site_package-jpg

  • 1

    Adds the full error stacktrace instead of a screenshot of the screen.

  • 2

    The error you have identified is that you are missing the requests module.. try gives one : pip install requests

1 answer

1

In this case, the error occurs because you are making a request without having the library requests installed, if you use python3, type this command in the terminal:

sudo pip3 install requests
  • there is incompatibility between versions? Version of python (3.6) and python-twitter (I think it’s version 3. something). I don’t remember the version and I haven’t tested your answer yet because I’m on a computer that doesn’t have the project I’m studying. Probably tomorrow I make the changes in the library installation.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.