Python package for interacting with NASA APO API
Project description
nasa-apod
Creating PyPi package
- python virtual environment for this project
python3 -m venv venv
activate venv
source venv/bin/activate
-
project structure
nasa-apod
--- nasa_apod
-------init.py
-------apod.py
---.gitignore
---README.md
---setup.py
---pyproject.toml -
Packaging
install required packages to create pypi package
pip install setuptools --upgrade pip install wheel pip install twinebuild distribution package
python3 setup.py sdistupload to pypi
twine upload dist/*
installing package
pip install nasa_apod
export you NASA API KEY to env
store your NASA_API_KEY in .env file , and make sure you add .env to .gitignore file.
e.g
NASA_API_KEY=You NASA API KEY
usage
from nasa_apod import apod
import os
# Load environment variables from .env file
load_dotenv()
# Read API key from environment variable
api_key = os.getenv('NASA_API_KEY')
if api_key:
# Initialize APODService with API key
apod_service = apod.APODService(api_key)
# Get today's picture
picture_data = apod_service.get_picture()
print(picture_data)
else:
print("NASA_API_KEY environment variable not found.")
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 Distributions
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 nasa_apod-1.0.0-py3-none-any.whl.
File metadata
- Download URL: nasa_apod-1.0.0-py3-none-any.whl
- Upload date:
- Size: 2.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
164d014b5b4d3b33faca0063f61aafd994166b5d48fe402753dc84c79cc3e0d1
|
|
| MD5 |
48a9d11403f46dc0d0ab03f70ab31ba0
|
|
| BLAKE2b-256 |
8f3b18b79116c73419f234a8de2b204edc23769f69c0c27c0945a1715c806ac7
|