Skip to main content

Pacifica Python Downloader

Project description

Pacifica Python Downloader

Build Status Build Status Test Coverage Maintainability

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


Download files

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

Source Distribution

pacifica-downloader-0.2.3.tar.gz (13.1 kB view details)

Uploaded Source

Built Distributions

pacifica_downloader-0.2.3-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

pacifica_downloader-0.2.3-py2-none-any.whl (8.6 kB view details)

Uploaded Python 2

File details

Details for the file pacifica-downloader-0.2.3.tar.gz.

File metadata

  • Download URL: pacifica-downloader-0.2.3.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for pacifica-downloader-0.2.3.tar.gz
Algorithm Hash digest
SHA256 192d130384960e975a50a9656d1d1444414f5dd0b5213bb55ce293d55c3afdb1
MD5 5bdfdd90f288298970a77d584614ab25
BLAKE2b-256 3af75824a220f7bc899a28a366acb3d8154706f648e38e0f7ad75ec05ac68179

See more details on using hashes here.

File details

Details for the file pacifica_downloader-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: pacifica_downloader-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for pacifica_downloader-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ef1cb5d3efa3dbf6a2575a99d05677a31310af62255d4cf728b87b2df059e3bd
MD5 a32a744850c7f8a0934d9d69959753fd
BLAKE2b-256 ba15f4039d8c100b0bad6fd0dee95cf94b8685d8bfc97fd037ace31f9861e165

See more details on using hashes here.

File details

Details for the file pacifica_downloader-0.2.3-py2-none-any.whl.

File metadata

  • Download URL: pacifica_downloader-0.2.3-py2-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.14

File hashes

Hashes for pacifica_downloader-0.2.3-py2-none-any.whl
Algorithm Hash digest
SHA256 4c780e409bf30ed9f2946436d21c5bfafe035c8135280396666df866121cb8d2
MD5 559007a2b60381eed78b0440f9e1c7ac
BLAKE2b-256 1749a2cd9c92efe363fa57df17437cd3126cc8bfa7655fcb72b4a4a13260daeb

See more details on using hashes here.

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