UnsplashRandDownloader
Python Unsplash Random Image Downloader.
This component periodically download and store random images based of specified topics from Unsplash platform and allows the user to request one of the downloaded images. It keeps control of the Unsplash API requests limits, and using some kind of "image files rotate" of the storage (removing and replacing older images with newer ones), it also control and limit the maximum number of images downloaded in the filesytem.
Installation
From Pypi:
python3 -m pip install unsplash_rand_downloader
From Sources:
git clone https://www.github.com/J-Rios/unsplash_rand_downloader
cd unsplash_rand_downloader
python3 -m pip install .
Usage
# Import the module
from unsplash_rand_downloader import UnsplashRandDownloader
# Set your Unsplash API access account identification parameters
# (Application Name, Client ID and Client Secret Key)
APP_NAME = "XXXXXXXXXXXXXXX"
CLIENT_ID = "XXXXXXXXXXX_XXXXX-XX-XXXXXXXXXXXXXXXXXXXXXX"
CLIENT_SECRET = "XXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
# Unsplash API mode to use (API_DEMO or API_PRODUCTION)
API_MODE = UnsplashRandDownloader.API_DEMO
# Limit the number of images to be downloaded (None, to use the maximum
# calculated number from Unsplash API request limits DEMO/PRODUCTION)
LIMIT_MAX_NUM_IMG = None
# Path of directory to store the downloaded images
IMAGES_DOWNLOAD_DIR = "./images"
# Size of images to download
IMG_WIDTH = 320
IMG_HEIGHT = 240
# Topics of images to download
TOPICS = ["bird", "halloween", "fire", "computer"]
# Setup the Downloader
unsplash = UnsplashRandDownloader(APP_NAME, CLIENT_ID, CLIENT_SECRET, API_MODE)
unsplash.setup(IMAGES_DOWNLOAD_DIR, TOPICS, IMG_WIDTH, IMG_HEIGHT,
LIMIT_MAX_NUM_IMG)
# Launch the Downloader
unsplash.start()
# Wait some time to allow UnsplashRandDownloader download some images
# ...
# Request a random image from downloaded images
img = unsplash.get_random_image()
if img is not None:
print("Image Topic: {}".format(img["topic"]))
print("Image ID: {}".format(img["id"]))
print("Image Attribution: {}".format(img["attribution"]))
#print("Image Raw: {}".format(img["image"]))
# To exit your application, remember to stop the downloader before
unsplash.stop()
Metadata
Release files for unsplash-rand-downloader 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| unsplash_rand_downloader-1.0.0.tar.gz | 8.3 kB | Without provenance | Details for unsplash_rand_downloader-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| unsplash_rand_downloader-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for unsplash_rand_downloader-1.0.0-py3-none-any.whl |
Total release size: 17.0 kB
Release files / unsplash_rand_downloader-1.0.0.tar.gz
| Download URL | unsplash_rand_downloader-1.0.0.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2aa5baf37ac0a9a5518fc8630bc74ce8517b96bcaba13f0e68c9928454e3fc2b
|
|
BLAKE2b-256 checksum How to use checksums |
af400c762deb1395028b1432056b2a4b5deb72195cae0b3fcd55e8d004de0564
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.4.2 requests/2.20.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
|
Release files / unsplash_rand_downloader-1.0.0-py3-none-any.whl
| Download URL | unsplash_rand_downloader-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
81586103ff842a1440f3b39fd53ac4ed9c9f4a2080ca3582940499deae5c0b45
|
|
BLAKE2b-256 checksum How to use checksums |
bfe75112d3034955e413872f95ea96666c40e60b46dfe5199ff796fdd3002f0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.4.2 requests/2.20.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
|
Security for unsplash-rand-downloader 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.