Answers for "how to hide api key in github python"

0

how to hide api key in github python

### Step1: Create config.py file
### Step2: add this code into config.py file
# .gitignore should include reference to config.py
api_key = "YOUR_KEY"
api_secret = "YOUR_SECRET"
### Step3: add below code into main.py
import config
from twython import Twython, TwythonError
# create a object by passing the necessary secret passwords
api_key = config.api_key
api_secret = config.api_secret
#### Step4:add below code into .gitignore
config.py
__pycache__
.ipynb_checkpoints
Posted by: Guest on July-01-2021

Python Answers by Framework

Browse Popular Code Answers by Language