Skip to main content

Py CGRrateS

Project description

Python CGRateS Api Client

PyPI version




pip install py_cgrates


Account Management - Create

from cgrates import Client
from cgrates import models

api = Client(tenant="demo")  # host=localhost, port=2080

account = api.add_account(account="AcmeWidgets")

=> <Account(account=AcmeWidgets,...)>

dest = api.add_destination("DST_64", prefixes=["64"])

=> <Destination(DST_64, [64])>

rates = api.add_rates(rate_id="RT_STANDARD", rates=[
models.Rate({"rate": 0.25, "rate_unit": 60, "rate_increment": 60})

=> [<Rate(rate=0.25, rate_unit=60,...)>]

dest_rates = api.add_destination_rates(dest_rate_id="DR_64", dest_rates=[
models.DestinationRate({"rate_id": "RT_STANDARD", "dest_id": "DST_64"})

=> [<DestinationRate(rate_id=RT_STANDARD, dest_id=DST_64,...)>]

timing = api.add_timing(timing_id="WEEKEND", week_days=[6, 7])

=> <Timing(timing_id=WEEKEND,...)>

rating_plans = api.add_rating_plans(rating_plan_id="RPL_CASUAL", rating_plans=[
models.RatingPlan({"dest_rate_id": "DR_64", "timing_id": "WEEKEND"})

=> [<RatingPlan(dest_rate_id=DR_64, timing_id=WEEKEND,...)>]

rating_profiles = api.add_rating_profiles(rating_profile_id="RPF_1", subject="*any",rating_plan_activations=[
models.RatingPlanActivation({'rating_plan_id': 'RPL_CASUAL', 'activation_time':})


Account Management - Get/List

api = Client(tenant="demo")

account = api.get_account(account="AcmeWidgets")

=> <Account(account=AcmeWidgets,...)>

dest = api.get_destination(destination_id="DST_64")

=> <Destination(DST_64, [64])>

rates = api.get_rates(rate_id="RT_STANDARD")

=> [<Rate(rate=0.25, rate_unit=60,...)>]

timing = api.get_timing(timing_id="WEEKEND")

=> <Timing(timing_id=WEEKEND,...)>

rating_plans = api.get_rating_plans(rating_plan_id="RPL_CASUAL")

=> [<RatingPlan(dest_rate_id=DR_64, timing_id=WEEKEND,...)>]

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for py-cgrates, version 0.0.5
Filename, size File type Python version Upload date Hashes
Filename, size py_cgrates-0.0.5-py3-none-any.whl (8.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size py-cgrates-0.0.5.tar.gz (5.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page