A small package to easily read API keys from env files
Project description
read-env
Boilerplate code to read API keys from a .env file in Python
Quickstart
Functions to choose from include
read_pair_from_env: Read key pair from specified env fileread_key_from_env: Read API key from specified env fileread_sec_from_env: Read API secret from specified env file
You can install the read-env-keys package via pip
pip3 install read-env-keys
After installing, you will be able to import the module using
from read_env_keys import *
or
import read_env_keys
Read an API key from your .env file
After you have installed the package, create an env file (if you do not have one already) in your current working directory (cwd).
-
MacOS / Unix
Get the current working directory's absolute path by typing
pwdin the terminal. Copy and paste this as a string with the name of your env file appended (including the
.envextension) as an argument. -
Windows
Get the current working directory's absolute path by typing
cdin the command line.
Once you have the full path to the env file, pass it as an argument. You can optionally specifiy the API key name to read.
from read_env_keys import *
# Read an API Key. Default key name is 'API_KEY'
api_key_value = read_key_from_env(YOUR_ENVS_ABSOLUTE_FILEPATH)
# Read an API Key and specify the key name in the env file
api_key_value = read_key_from_env(YOUR_ENVS_ABSOLUTE_FILEPATH, api_key='my_key')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file read_env_keys-0.0.2.tar.gz.
File metadata
- Download URL: read_env_keys-0.0.2.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a803cec4dbdcc9bf8526e304147d1ae631b98f1823c7ae79e5f630c7aaa21171
|
|
| MD5 |
fe1a47737614e30b71486a2208c8cd29
|
|
| BLAKE2b-256 |
5623ca929b36f7ae72e9dddde9fb7b757162bfa07f8bacc11c6c290c3c2e4947
|
File details
Details for the file read_env_keys-0.0.2-py3-none-any.whl.
File metadata
- Download URL: read_env_keys-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8667441140b7368f59c81ba32cdd5e8afe34f5f46378513c9227fa79ef2d4af
|
|
| MD5 |
d39678a111b50c6a5e1891ee918cb75a
|
|
| BLAKE2b-256 |
a9d5d73fd81be4f20e46a246be4348afc657a1fd1fbc5f1b8cfa7769e545ea1a
|