Skip to main content

Py CGRrateS

Project description

Python CGRateS Api Client

PyPI version

WIP

See: https://github.com/cgrates/cgrates

Install

pip install py_cgrates

Usage

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': datetime.now()})
])

api.reload_cache()

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.

Source Distribution

py-cgrates-0.0.5.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

py_cgrates-0.0.5-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file py-cgrates-0.0.5.tar.gz.

File metadata

  • Download URL: py-cgrates-0.0.5.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for py-cgrates-0.0.5.tar.gz
Algorithm Hash digest
SHA256 28a609623709c94328019250956623c0acd1ab0905c9fb4ef6d8655dd5c9bad2
MD5 02c11bfc6545e4ab3de7c594c23bb8e6
BLAKE2b-256 6557c33a7e40a774067318bb33d8ffd02d5e6e23140610a9a3c205a5d7bb7ba4

See more details on using hashes here.

File details

Details for the file py_cgrates-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: py_cgrates-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for py_cgrates-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0114905ae8f73d4bc082956e02218c3eb8a242dbe3068dd62dfd4080c3d4b4e6
MD5 dcbad2edd83e9b0dad862e7aae59284e
BLAKE2b-256 eb875281874920db376fc5f99a607568d55f3c5bb8ffa183480f73522c676bed

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page