Skip to main content

A Python library to interact with ASTR servers.

Project description

# lib-python-astr

[![PyPI version](](
[![License: MPL 2.0](](

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at

### Purpose

Libastr is a **Python3** library designed to ease python scripting with
the API of A.S.T.R. (Archiving System Truly RESTful).
It includes multiple features like browsing, downloading and uploading archives.

### Installation

1. Git clone the repository.

2. Install the library with pip. It is advised to use
pip install lib-python-astr

### Configuration

To communicate with the ASTR server, three parameters must be given to the
an instance of the class `AstrClient`:
* base_url: ASTR instance base url (e.g. http://my-astr-server:8000)
* email: a user email
* token: a token of this user (to be generated on the website)

from libastr import AstrClient
client = AstrClient(base_url, email, token)

Or, to avoid giving all these parameters manually, they can be stored in
environment variables:

export LIBASTR_URL='http://my-astr-server:8000'
export LIBASTR_TOKEN='b4b71bf6-a3dd-4975-85b8-03de05096fc0'

Then, if you make an instance of `AstrClient` without giving arguments, it
will fetch these environment variables by default.

### Basic usage

from libastr import Browser

# If you use environment variables to connect to the server...
browser = Browser()
# Or if yo use custom variables...
from libastr import AstrClient
client = AstrClient(base_url, email, token)
browser = Browser(client)

# Retrieve some archives
my_archives = browser.get_archives_by_args(
author="John DOE",
category="MY CATEGORY",
descriptors={"my_desc": "MY VALUE"})

# download an archive

# Retrieve all categories
cat = browser.get_all_archive_categories()

# Get descriptors of one category

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

libastr-1.1.0.tar.gz (8.5 kB view hashes)

Uploaded source

Built Distribution

libastr-1.1.0-py3-none-any.whl (10.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page