Skip to main content

Python package for interacting with NASA APO API

Project description

nasa-apod

Creating PyPi package

  1. python virtual environment for this project
python3 -m venv venv

activate venv

source venv/bin/activate
  1. project structure

    nasa-apod
    --- nasa_apod
    -------init.py
    -------apod.py
    ---.gitignore
    ---README.md
    ---setup.py
    ---pyproject.toml

  2. Packaging

    install required packages to create pypi package

    pip install setuptools --upgrade
    pip install wheel
    pip install twine
    

    build distribution package

    python3 setup.py sdist
    

    upload 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nasa_apod-1.0.3-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

Details for the file nasa_apod-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: nasa_apod-1.0.3-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

Hashes for nasa_apod-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1e0b203d38b6624346b699805b5bd7459f1a9403c6c9541951d885946654dd5c
MD5 654890242ca7b6ef372b913399a9e78e
BLAKE2b-256 cc35cbada7199f29d84d12709feff9fe21090a6cd1982c4a02293042b3843cfd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page