Skip to main content

Rabbit service client

Project description

[![Build Status](https://travis-ci.org/puntonim/service-rabbit.svg?branch=master)](https://travis-ci.org/puntonim/service-rabbit)

# Rabbit service client

This package is service client for Rabbit API.

## Client usage

```python
# Configure settings.
import service_rabbit.conf
d = dict(
BASE_URL='http://inspire-prod-broker1.cern.ch:15672/api',
REQUEST_TIMEOUT=30,
HTTP_AUTH_USERNAME='user',
HTTP_AUTH_PASSWORD='pass',
)
service_rabbit.conf.settings.configure(**d)

# Use the client.
from service_rabbit.client import RabbitClient
client = RabbitClient()
response = client.get_queue('inspire', 'orcid_push')
response.raise_for_result()
consumers = response.get_consumers_count()
messages = response.get_messages_count()
```

## Development

```bash
# Create a venv and install the requirements:
$ make venv

# Run isort and lint:
$ make isort
$ make lint

# Run all the tests:
$ make test # tox against Python27 and Python36.
$ tox -e py27 # tox against a specific Python version.
$ pytest # pytest against the active venv.

# Run a specific test:
$ make test/tests/test_client.py # tox against Python27 and Python36.
$ tox -e py27 -- tests/test_client.py # tox against a specific Python version.
$ pytest tests/test_client.py # pytest against the active venv.
```

To publish on PyPi, first set the PyPi credentials:

```bash
# Edit .pypirc:
$ cat $HOME/.pypirc
[pypi]
username: myuser
password: mypass
```

```bash
# Edit the version in `setup_gen.py`.
# ... version=pep440_version('1.1.1'),
# Then generate setup.py with:
$ make setup.py
# Commit, tag, push:
$ git commit -m '1.1.1 release'
$ git tag 1.1.1
$ git push origin master --tags

# Finally publish:
$ make publish
```

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

service-rabbit-1.0.0.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file service-rabbit-1.0.0.tar.gz.

File metadata

  • Download URL: service-rabbit-1.0.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.10

File hashes

Hashes for service-rabbit-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0bb46d261b33f0a3b61b546db66bed971f3bea229afa310cf05aac7714a96c68
MD5 73dd6a732a09d7c94f0520a6cfdd7067
BLAKE2b-256 2deaf6d64ad3bcb0865215b0c9469f40f1b6a58ab27b63eb028824891b1c3221

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