twitter on python3

I used the twitter library to get tweets from twitter https://github.com/sixohsix/twitter

Register the app

https://dev.twitter.com/apps

After registration, check the Consumer key and Consumer secret

Acquisition of OAUTH_TOKEN and OAUTH_SECRET

The oauth_dance function is provided in the twitter library, so call it. After calling, the app authentication screen opens in the browser, so if you log in, the PID will be displayed. Enter the PID into the console and press Enter. Oauth_Token and Oauth_secret are output.

oauth_test.py


from twitter import *
#The first number may be anything.
#If you specify a file name for the 4th animal, it will be saved in that file
print(oauth_dance('hoge',consumer_key, consumer_secret))

Load timeline

get_timeline


from twitter import *
 
#Each token obtained above,Set secret and access
t = Twitter(
            auth=OAuth(OAUTH_TOKEN, OAUTH_SECRET,
                       CONSUMER_KEY, CONSUMER_SECRET)
           )
t.statuses.home_timeline()

Recommended Posts

twitter on python3
Twitter posts on Python 3 etc.
Python on Windows
python on mac
Python on Windbg
[Memo] Tweet on twitter with python
Python conda on cygwin
Character count on Twitter
Install Python on Pidora.
Install Scrapy on python3
Install Python on Mac
Install Python 3 on Mac
Install Python3.4 on CentOS 6.6
Installing pandas on python2.6
python basic on windows ②
Install python on windows
Install Python 2.7.3 on CentOS 5.4
Search Twitter using Python
build Python on Ubuntu
Install Python 3.3 on Ubuntu 12.04
Install Python 3.4 on Mac
Install Python 3.6 on Docker
Set-enable Python virtualenv on Windows
Set up Python 3.4 on Ubuntu
Run Openpose on Python (Windows)
Use matplotlib on Ubuntu 12 & Python
Install watchdog on Windows + Python 3.3
Python on Ruby and angry Ruby on Python
[Python] This is easy! Search for tweets on Twitter
Twitter graphing memo with Python
Get Twitter timeline with python
Use Twitter API with Python
Install pygame on python3.4 on mac
Python + Kivy development on Windows
Install Python 3.8 on CentOS 7 (SCL)
Real-time graphs on Plotly (Python)
Made python available on macOS
Sphinx-autobuild (0.5.2) on Windows7, Python 3.5.1, Sphinx 1.3.5
Post to Twitter using Python
Automatic follow on Twitter with python and selenium! (RPA)
Put Python 3.x on Ubuntu
Fastest Python installation on Windows
[Python] Notes on data analysis
Build Python environment on Windows
Run Tensorflow 2.x on Python 3.7
Handling of python on mac
Update python on Mac to 3.7-> 3.8
Install pandas 0.14 on python3.4 [on Mac]
Install OpenCV on Ubuntu + python
Notes on installing Python on Mac
Run Python CGI on CORESERVER
Run unix command on python
Build python environment on windows
Python --Install MySQLDB on EC2
Introducing TensorFlow on Ubuntu + Python 2.7
Install Python 3.8 on CentOS 8 (AppStream)
I ran python on windows
Search twitter tweets with python
Broadcast on LINE using python
[Python] [Chainer] [Windows] Install Chainer on Windows
Use Python on Windows (PyCharm)