how to use Api Key without directly using it in the python code?

Viewed 704

I want get data using HubSpot Api in Python, however, I don't want to show my ApiKey in the code. What would be the best practice to get data using Api Without showing your Api key? I am currently working in Jupyter notebook.

2 Answers

https://www.youtube.com/watch?v=YdgIWTYQ69A u can flow this tutorial

Simply create a file name ".env" and write your API key in Like this : "API_KEY = YOUR_API_KEY"

then run "pip3 install dotenv" in your cmd

then in your code, add some lines :

from dotenv import load_dotenv
import os

load_dotenv()

API_KEY=os.getenv("API_KEY")
Related