Skip to main content

NASA APOD image download

Project description

# nasa-apod-wallpaper
Utilizes NASA APOD API to generate wallpapers with explanations.
* Will download images (single, random or all in date range)
* Only supports image media types (no video).
* Uses tkinter to attempt to size wallpaper if not specified.
* By default, adds explanation of daily images in watermarked footer.

# Install
Requires Python3/pip3.
```
pip3 install apod_wallpaper
```

## Configuration
Get your NASA API key [here](https://api.nasa.gov/index.html#apply-for-an-api-key)

Set `NASA_API_KEY` environment variable to your key.

## Dependencies
See [#acknowledgements]
```
pip3 install -r requirements.txt
```

# Usage

## Download single date
``` python
from apod_wallpaper import apod
from datetime import date

apod.download_single(single_date=date(2015, 07, 01))
```

## Download random
Defaults to `start_date=date(1995, 6, 20)` (the first day NASA began posting daily pics), and `end_date=date.today()`
``` python
from apod_wallpaper import apod

apod.download_random()
```

## Download bulk
Select range of APOD (good for catching up on recent misses)
``` python
from apod_wallpaper import apod
from datetime import date

apod.download_bulk(start_date=date(2015, 07, 01), end_date=date(2015, 07, 05))
```

All NASA APOD images (BE NICE: you probably don't need this)
``` python
from apod_wallpaper import apod

apod.download_bulk()
```



## Optional arguments
```
download_path: (optional) File location to store downloaded image (default ~/wallpapers).
screen_width: (optional) Pixels of width to make image. Large than original will add a black background. If not specified, OS detection of screen width will be attempted.
screen_height: (optional) Pixels of height to make image. Large than original will add a black background. If not specified, OS detection of screen width will be attempted.
font: (optional) TrueType font to apply in image footer (default OpenSans-Regular.ttf).
font_size: (optional) Size of TrueType font in image footer (default 18).
margin: (optional) Pixels around image footer text (default 50).
font_color: (optional) RGBA tuple for color of font (default white).
background_color: (optional) RBGA tuple for color of background (default black).
opacity: (optional) Opacity for image footer (default 0.8).
``
`

# Tests
TODO: tests

# Acknowledgements
NASA APOD access via [Bowshock](https://github.com/emirozer/bowshock) wrapper library
Open Sans font from [Font Squirrel](http://www.fontsquirrel.com/)
Image processing by [Pillow](https://github.com/python-pillow/Pillow)

Project details


Supported by

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