RevOps Python Client
Project description
A python module for integrating RevOps
Installation
Install from PyPi using pip, a package manager for Python.
pip install revops
Don't have pip installed? Try installing it, by running this from the command line:
$ curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
Or, you can download the source code
(ZIP) for revops-python
, and then run:
python setup.py install
Getting Started
Create a RevOpsAPI
client.
from revops.api import RevOpsAPI
api = RevOpsAPI()
Authentication
Get your API token from your RevOps instance. Set the token to REVOPS_API_KEY in your environment variables.
export REVOPS_API_KEY="xxxxxxxxxxxxxxxxxxxxxxx"
from revops.api import RevOpsAPI
api = RevOpsAPI()
Send your first UsageEvent
from revops.api import RevOpsAPI
# Make sure you've set your REVOPS_API_KEY env var.
# $> export REVOPS_API_KEY="xxxx"
api = RevOpsAPI()
# Create a UsageEvent Request
product_usage = api.usage.events.create(
transaction_id = "my-first-usage-event-1",
mode = "insert",
)
# Add an hourly outbound-voice-minutes with the value 100
# To the UsageEvent request
product_usage.add_metric(
account_id = "my-first-account-id-1",
product = "voice-minutes",
metric_name = "outbound-voice-minutes",
metric_value = 100,
metric_resolution = "hour",
)
product_usage.commit()
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
revops-0.0.6.tar.gz
(4.5 kB
view details)
File details
Details for the file revops-0.0.6.tar.gz
.
File metadata
- Download URL: revops-0.0.6.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c97ba4a54d73215a535035b07d5348104b15d678910b40209b76afe7eecc8404 |
|
MD5 | 02b7524b67f662f4ab88c0362aade3a4 |
|
BLAKE2b-256 | 1fc518299e56e041c5909493939c142d69868fef53daa9eb67e0e7f98e154856 |