A Python Fastly API client library
Actively maintained. Last release 12 days ago, commits in 5 of the last 26 weeks. A safe choice.
pip install fastlyfastly-py
A Python client library for interacting with most facets of the Fastly API.
Requirements
Python >=3.6
Installation
python3 -m pip install fastly
Usage
import fastly
from fastly.api import acl_api
from pprint import pprint
# Authorize the client with a Fastly API token.
configuration = fastly.Configuration()
configuration.api_token = 'YOUR_API_KEY'
# Enter a context with an instance of the API client
with fastly.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = acl_api.AclApi(api_client)
service_id = "SU1Z0isxPaozGVKXdv0eY" # str
version_id = 1 # int
name = "test-acl" # str
try:
# Create a new ACL
api_response = api_instance.create_acl(service_id, version_id, name=name)
pprint(api_response)
except fastly.ApiException as e:
print("Exception when calling AclApi->create_acl: %s\n" % e)
Authorization
[!NOTE] The Fastly API requires an API token for most operations.
Set it by assigning api_token to a configuration as shown:
# Authorize the client with a Fastly API token.
configuration = fastly.Configuration()
configuration.api_token = 'YOUR_API_KEY'
Alternatively, set the FASTLY_API_TOKEN environment variable.
API Endpoints
Table of API endpoints
| Class | Method | Description |
|---|---|---|
| AclApi | create_acl | Create a new ACL |
| AclApi | delete_acl | Delete an ACL |
| AclApi | get_acl | Describe an ACL |