Pacifica Python Downloader
Project description
Pacifica Python Downloader
Pacifica Python Library for Downloading Data
This repository provides a library so python applications can download data from Pacifica.
Downloader API
The entrypoint for this library is the Downloader
class in
the downloader
module. Instances of this class are created
with a download directory and a
Pacifica Cartd
endpoint url.
Downloader Class
The constructor takes
two arguments location
and cart_api_url
. The location
is
a download directory to be created by a download method. The
cart_api_url
is the endpoint for creating carts.
The other methods in the Downloader
class are the supported
download methods. Each method takes appropriate input for that
method and the method will download the data to the location
defined in the constructor.
CloudEvents is a
standard for how to send messages between services in cloud
environments. The cloudevent()
method
(here)
consumes the event emitted by the
Pacifica Notifications
service and downloads the data.
Internal Classes and Methods
The internal classes help organize the work around the cart API.
Cart API
The CartAPI class has two methods used for setting up a cart and waiting for completion.
The setup_cart()
method takes a callable argument that returns
an iterator. The iterator returns a list that is directly sent to
the Cartd API. The
setup_cart()
method returns the full url to the cart created.
The wait_for_cart()
method takes a cart url returned from the
setup_cart()
method and polls the endpoint until the cart is
ready to download.
CloudEvent
The CloudEvent
class (here)
contains the cloudevent()
method. It
requires the cloud event as an argument. The cloudevent()
generates a method that yields the cart file objects from the
cloud event.
Examples
CloudEvents Example
This is a basic stub code to download data from a cloud event. This assumes the cloudevent is saved to a file for processing. There are a number of ways to get the cloud event this is just a minimum representation of whats required.
from json import loads
from tempfile import mkdtemp
from pacifica.downloader import Downloader
cloud_event = loads(open('cloudevent.json').read())
down_path = mkdtemp()
down = Downloader(down_path, 'http://metadata.example.com')
down.cloudevent(cloud_event)
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 Distributions
File details
Details for the file pacifica-downloader-0.3.0.tar.gz
.
File metadata
- Download URL: pacifica-downloader-0.3.0.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a6cb658cb7c2ab953feba742b8c11ad8927c1b271768bbda5d7b1bd535b7492 |
|
MD5 | 7746044efefe058233d4f211789a9ca7 |
|
BLAKE2b-256 | fc792a2b450f9cb330cc4423acfef30cb835f0ecab6f7d64df52e27198f53c96 |
File details
Details for the file pacifica_downloader-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: pacifica_downloader-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b05735bb90416e0cdaeb24ffd7d118e67fdaabda877f8be87d5e1fe5a4aa8a6 |
|
MD5 | 517d0856514671b43e32dce548867a32 |
|
BLAKE2b-256 | fc1e39bde20b39992cee0e0c546018796e98dc4f95bddf093daf99bc27ffe661 |
File details
Details for the file pacifica_downloader-0.3.0-py2-none-any.whl
.
File metadata
- Download URL: pacifica_downloader-0.3.0-py2-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cd6f9aaf8f6d37f8864936d93e786ed085687162be61c1512096a2f87d87b18 |
|
MD5 | cbc2998b8ce0639be14f44cf0ea5881b |
|
BLAKE2b-256 | 0fb94e100923e4e23392b1f4e290a78f8a675baf7a0c57a4a905a0358d99ca36 |