-
Clone (or download) this repository to your computer and navigate to the folder once it's downloaded. You can clone the repository with this command in your terminal:
git clone https://github.com/DHRI-Curriculum/twitter-api.git
Once you've cloned or downloaded the directory, navigate into it using your command line.
-
Open the my_keys.py file in your text editor, VS Code.
-
Copy your four numbers (Consumer Key, Consumer Secret, Access Token Key, and Access Token Secret), replacing the
xxx
on each relevant line. Make sure to keep the single quotes around the numbers. -
Save the
my_keys.py
file. -
Make sure you have the Tweepy library for Python installed. To check, type
python
at the command line. When you see the >>> prompt, type
import tweepy
If you see no output, then Tweepy is already installed, so skip to Step #7. If you get an error, follow Step #6. Once you're finished with Python, type
exit()
to return to the bash shell.
-
If Tweepy isn't installed, run
pip install tweepy
at the bash shell to install the library.
-
To test out your key, run the api.py script:
python api.py
If you see the name of your Twitter account, everything is working!