Skip to main content

3scale API python client

Project description

3scale REST API client in Python

3Scale REST API client in a wrapper over the 3scale API.

lint & smoke


Install and update using pip:

pip install 3scale-api

Or as a dependency using the pipenv

pipenv install 3scale-api


Client supports basic CRUD operations and it using the official 3scale API.

The API can be found at <>/p/admin/api_docs

Basic usage of the client:

from threescale_api import ThreeScaleClient, resources
from typing import List

client = ThreeScaleClient(url="", token="secret_token", ssl_verify=True)

# Get list of APIs/Services or any other resource
services: List[resources.Service] =

# Get service by it's name
test_service: resources.Service =["test_service"] # or use:

# Get service by it's id
test_service: resources.Service =[12345] # or use

# To get raw JSON response - you can use the fetch method - it takes the service id
raw_json: dict =

# To create a new service (or any other resource), parameters are the same as you would provide by the documentation
new_service: resources.Service ='my_testing_service', name="My Testing service")

# In order to update service you can either[123456].update(param="new_value")
# or
service: resources.Service =[123456]
service['param'] = 'new_value'

# To get a proxy config you can use
proxy: resources.Proxy =['test_service']

# To update the proxy you can either
proxy: resources.Proxy =['test_service'].proxy.update(parameter_to_update='update')
# or
proxy_instance =['test_service']
proxy_instance['param'] = 'new_value'

# On the service you can access the:
service: resources.Service =[123456]
service.proxy           # The PROXY client
service.mapping_rules   # mapping rules client
service.metrics         # metrics
service.app_plans       # application plans

# The proxy supports:
proxy =
proxy.promote(version=1, from_env="sandbox", to_env="production") # The promote operation
proxy.mapping_rules # The mapping rules
proxy.configs       # proxy configurations client
proxy.policies      # Policies defined for the API

Run the Tests

To run the tests you need to have installed development dependencies:

pipenv install --dev

and then run the pytest:

pipenv run pytest -v

Integration tests configuration

To run the integration tests you need to set these env variables:



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

3scale-api-0.32.0.tar.gz (34.0 kB view hashes)

Uploaded source

Built Distribution

3scale_api-0.32.0-py3-none-any.whl (52.5 kB view hashes)

Uploaded py3

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