Skip to main content

Togai Apis

Project description

togai-client

PyPI

Togai is an end to end pricing infrastructure that enable you with metering, aggregating, pricing and billing for your application.

This is an official Typescript client library for using Togai APIs.

Requirements.

Python 3.8+

Installation & Usage

pip install

pip install togai-client

(you may need to run pip with root permission: sudo pip install togai-client)

Then import the package:

import togai_client

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import togai_client

Getting Started

Please follow the installation procedure and then run the following: You will need a API_TOKEN to use the API. You can get one from your Togai Account

import time
import togai_client
from pprint import pprint
from togai_client.api import accounts_api
from datetime import datetime
from pydantic import Field, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Optional, Union
from typing_extensions import Annotated
from togai_client.models.account import Account
from togai_client.models.account_aliases_paginated_response import AccountAliasesPaginatedResponse
from togai_client.models.account_paginated_response import AccountPaginatedResponse
from togai_client.models.add_account_aliases_request import AddAccountAliasesRequest
from togai_client.models.base_success_response import BaseSuccessResponse
from togai_client.models.create_account_request import CreateAccountRequest
from togai_client.models.create_proposal_request import CreateProposalRequest
from togai_client.models.create_purchase_request import CreatePurchaseRequest
from togai_client.models.edit_pricing_schedule_request import EditPricingScheduleRequest
from togai_client.models.get_proposal_response import GetProposalResponse
from togai_client.models.get_purchase_response import GetPurchaseResponse
from togai_client.models.pricing_schedule_paginated_response import PricingSchedulePaginatedResponse
from togai_client.models.proposal import Proposal
from togai_client.models.proposals_paginated_response import ProposalsPaginatedResponse
from togai_client.models.purchase import Purchase
from togai_client.models.purchase_paginated_list_data import PurchasePaginatedListData
from togai_client.models.remove_account_aliases_request import RemoveAccountAliasesRequest
from togai_client.models.update_account_request import UpdateAccountRequest
from togai_client.models.update_pricing_schedule_request_with_actions import UpdatePricingScheduleRequestWithActions
from togai_client.models.update_pricing_schedule_response import UpdatePricingScheduleResponse
from togai_client.models.update_proposal_status import UpdateProposalStatus
# Defining the host is optional and defaults to https://api.togai.com
# See configuration.py for a list of all supported configuration parameters.
configuration = togai_client.Configuration(
    host = "https://api.togai.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization (Bearer <credential>): bearerAuth
configuration = togai_client.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)


# Enter a context with an instance of the API client
with togai_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = accounts_api.AccountsApi(api_client)
    account_id = 'ACC00001' # str | account_id corresponding to an account
    add_account_aliases_request = togai_client.AddAccountAliasesRequest() # AddAccountAliasesRequest | Payload to add aliases to account

    try:
        # Add Aliases to account
        api_response = api_instance.add_aliases(account_id, add_account_aliases_request)
        pprint(api_response)
    except togai_client.ApiException as e:
        print("Exception when calling AccountsApi->add_aliases: %s\n" % e)

You can get a detailed step-by-step guide for a sample ingestion and metering at examples directory For a more detailed documentation for every api and models, please refer to the docs directory

Author

engg@togai.com

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

togai_client-1.0.3.tar.gz (230.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

togai_client-1.0.3-py3-none-any.whl (839.3 kB view details)

Uploaded Python 3

File details

Details for the file togai_client-1.0.3.tar.gz.

File metadata

  • Download URL: togai_client-1.0.3.tar.gz
  • Upload date:
  • Size: 230.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for togai_client-1.0.3.tar.gz
Algorithm Hash digest
SHA256 445c0be6d8c7d1db6d30685ff004d23b72f9a5d2b5df82656d453191923f8a1b
MD5 88686ee27da67ad20cdb139c39e2edee
BLAKE2b-256 3087f4e911897e91748b3f3fe2f1df7fc943249c56a0627e646e2d3c2d7cf19d

See more details on using hashes here.

File details

Details for the file togai_client-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: togai_client-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 839.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for togai_client-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f17327e2b61e3a56c5b54bc52ef7a78e424847281aa9ebbf2df4691fc2b648ac
MD5 2301c131dd78065fa33a28f17149d7f2
BLAKE2b-256 3a307fbf3266d7cd00387b928728262862a612c48d476a8168355453cb0c821c

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