A package for maintaining a download mirror / cache and splicing URLs into file templates.
Project description
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aurl_aurl-2.5.0.tar.gz.
File metadata
- Download URL: aurl_aurl-2.5.0.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.10.12 Linux/6.8.0-60-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
642a4c68f3013ca0ceec5d6d14f5d79aa4789bf546db9aef210b2eb1d1bdec64
|
|
| MD5 |
9a7d0e2cf44f846b57bf878083202798
|
|
| BLAKE2b-256 |
2e4bc9cba09891823dac0239c3e846ade3d8ce3e56082a0be10f4c7d5aa0085e
|
File details
Details for the file aurl_aurl-2.5.0-py3-none-any.whl.
File metadata
- Download URL: aurl_aurl-2.5.0-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.10.12 Linux/6.8.0-60-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e89ed7c03b3bc07e77fd972bc82c714804281cccbffd60cb7e7162003c052dc4
|
|
| MD5 |
0ef0c55e1730c757ed44266f2c10b46d
|
|
| BLAKE2b-256 |
1c499ad529f844b49792dde0b756c366969a00fc6011d4c7a5f74adb2905351e
|