Skip to main content

A package for maintaining a download mirror / cache and splicing URLs into file templates.

Project description

CI Coverage

aurl

A package for maintaining a download mirror / cache and splicing URLs into file templates.

This package provides two commands, get:

Usage: get [OPTIONS] URLS...

  Download a list of URLs.

Arguments:
  URLS...  urls to download  [required]

and subst:

Usage: subst [OPTIONS] TEMPLATES...

  Fetch and substitute URLs into a template.

Arguments:
  TEMPLATES...  File(s) to substitute.  [required]

Options:
  --results / --no-results        Don't substitute, but list required results.
                                  [default: no-results]

Template Format

Templates can include URLs inside ${{ }} splices. The [[tests/template.rc.tpl]] file demonstrates:

This is a test template

step1 = ${{ git://code.ornl.gov/DataTrails/1000water }}
root  = ${{ file:///usr/bin/last }}
github = ${{ git://github.com/frobnitzem/aiowire }}

Python API

Examining the source of subst reveals a TemplateFile and Mirror classes. The TemplateFile class parses and prints templates. Mirror provides the async functions fetch and fetch_all:

tf = TemplateFile(fname)
urls = set(tf.uris)

M = Mirror( Path() )
lookup = arun(M.fetch_all(urls))
tf.write(out, lookup)

The Mirror class also has encode, and decode, which translate URLs to/from fille paths inside the mirror's root path.

File server

This package includes a simple file server. To use it, follow certified's docs to launch aurl.serve:app.

certified init --host dtn.my.org --domain my.org 'My DTN Service'
certified serve aurl.serve:app https://0.0.0.0:4433

Your client can now access this file server using

# client configuration
pip install certified
certified init 'My client'
certified get-ident # ~> (send to certified introduce on server side to get intro.json)
certified add-intro intro.json
certified add-service https://dtn.my.org:4433 intro.json

# GET using certified's message util (serial)
message https://dtn.my.org:4433/file1.h5

# GET using aurl's get tool (parallel)
get https://dtn.my.org:4433/file1.h5 https://dtn.my.org:4433/file2.zarr

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

aurl_aurl-2.2.1.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

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

aurl_aurl-2.2.1-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file aurl_aurl-2.2.1.tar.gz.

File metadata

  • Download URL: aurl_aurl-2.2.1.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.10.12 Linux/6.8.0-57-generic

File hashes

Hashes for aurl_aurl-2.2.1.tar.gz
Algorithm Hash digest
SHA256 6a02d0a78d2e711979a81f7b0f3594eb40c239d7e644c557387c6133e4ade103
MD5 397070d7b980b7886ff0a76706b27617
BLAKE2b-256 9f850c35340947cebc9154bdf27258a2bfa26cacb77dc69529906580904ed96c

See more details on using hashes here.

File details

Details for the file aurl_aurl-2.2.1-py3-none-any.whl.

File metadata

  • Download URL: aurl_aurl-2.2.1-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.10.12 Linux/6.8.0-57-generic

File hashes

Hashes for aurl_aurl-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 58ded909a1a83c496f90e577371d71afd0a24d3f868a5701d61624685d03af1a
MD5 9e98640ef5c0483f2270aaaeb6af3e5f
BLAKE2b-256 8047312754f967f404518e982b216347e2c5530e260c1081b05eed5b1b92a9cd

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