Skip to main content

britney-utils

Britney-utils comes with some utilities to create and manage clients build by Britney.

https://secure.travis-ci.org/unistra/britney-utils.png?branch=master https://coveralls.io/repos/unistra/britney-utils/badge.png

Install

britney-utils is working on Python 2.7 and Python >= 3.2. To install the module, use pip

$> pip install britney-utils

Use it…

… to create a basic client

You can easily create a client with the get_client function. It will create and save the client to retrieve it later with his name, acting as a cache

import britney_utils

client = britney_utils.get_client('my_client',
                                  '/path/to/spore/description.json',
                                  base_url='http://my-rest-api.org/v1/')

… to reset an instance

If an instance is already created with a name you gave in first place, you can easily reset and rebuild it. In this example, we except that the my_client SPORE client already exist

client = britney_utils.get_client('my_client',
                                  '/path/to/spore/description.json',
                                  reset=True)

A new instance is created with the my_client name and saved

… to create a pre-build instance with middlewares

Creating a rich client with all middlewares needed activated is useful. You can do this like this

from britney.middleware import auth, format
import britney_utils

middlewares = (
    (format.Json, {'predicate': lambda env: env['format'] == 'json'}),
    (auth.Basic, {'username': 'toto', 'password': 'xxxxxx'}
)

client = britney_utils.get_client('my_client',
                                  '/path/to/spore/description.json',
                                  middlewares=middlewares)

Metadata

Release files for britney-utils 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for britney-utils 0.1.2
File Size Uploaded
britney-utils-0.1.2.tar.gz 2.9 kB Details

Release files / britney-utils-0.1.2.tar.gz

Download URL britney-utils-0.1.2.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
41d36177389465f7c671f208dc29bb990d7419a1ce954d11de5d106193f4a3e9
BLAKE2b-256 checksum
How to use checksums
88147fe7b33d29da82882891a8a764b40ece20802eeb3ee5426ebb1a31f958a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page