Elastly API
Project description
Elastly Python SDK
The official Python client for the Elastly REST API.
Elastly prices quote and order lines for B2B sellers. Send a line (product, customer, quantity) and get back a price with the reasoning behind it: which pricing rules fired, what each one added, and how confident the engine is. The engine learns from the outcomes you feed back, so prices improve over time.
This client covers the full v1 API:
- Prices: price up to 100 lines in one call.
- Ingest: push products, customers, quotes, and orders from your own system in staged batches.
- Write-backs: pull approved price changes into your system and confirm them once applied.
Install
pip install elastly
Requires Python 3.9 or newer.
Authenticate
Create an API key in the dashboard (Settings, then API keys). Keys are scoped: an erp key prices lines, a connector key ingests data and claims write-backs. Send the key as a bearer token.
Price a line
import uuid
import elastly
configuration = elastly.Configuration(access_token="elastly_live_...")
with elastly.ApiClient(configuration) as api_client:
prices = elastly.PricesApi(api_client)
response = prices.get_prices(
idempotency_key=str(uuid.uuid4()),
prices_request=elastly.PricesRequest(
lines=[
elastly.PricesRequestLinesInner(
product_sku="SKU-1042",
customer_external_id="CUST-88",
quantity=25,
)
]
),
)
for line in response.lines:
result = line.actual_instance
if result.ok:
print(result.price_cents, result.currency, result.reason_summary)
else:
print("failed:", result.code, result.message)
Every response line is either a priced result (ok is true) or a per-line error. One bad line never fails the batch.
Retries and idempotency
POST /v1/prices requires an Idempotency-Key header. Use a fresh key for each logical request and reuse the same key on retries. A replay returns the stored response, so a retried call never prices twice.
Close the loop
Elastly learns from the difference between the price it recommended and the price your team actually charged. When you ingest quotes, echo the pricingDecisionId you received from the prices call on the matching quote line. Skip that and the engine has nothing to learn from.
Documentation
- API reference
- Per-endpoint docs for this client live in docs.
About this repository
This code is generated from the Elastly OpenAPI contract, so pull requests against generated files get overwritten by the next release. If something is broken or missing, open an issue or email support@elastly.io.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file elastly-0.1.0.tar.gz.
File metadata
- Download URL: elastly-0.1.0.tar.gz
- Upload date:
- Size: 36.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6f0e1f52f243ccbc217bf461a6a71e7c7f13d3027d4839f9f15565c2332ea9f
|
|
| MD5 |
965f5364ce66280a3fd6e80f63fe80bc
|
|
| BLAKE2b-256 |
def2977c800cee878c4d3e01dc3690459b677cd83be465912e29166b6c71fdcd
|
Provenance
The following attestation bundles were made for elastly-0.1.0.tar.gz:
Publisher:
publish.yml on elastly/elastly-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
elastly-0.1.0.tar.gz -
Subject digest:
e6f0e1f52f243ccbc217bf461a6a71e7c7f13d3027d4839f9f15565c2332ea9f - Sigstore transparency entry: 2189818691
- Sigstore integration time:
-
Permalink:
elastly/elastly-python@9fdfd1a63de7b6aaf35be6c287ad3340c4313f8f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/elastly
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9fdfd1a63de7b6aaf35be6c287ad3340c4313f8f -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file elastly-0.1.0-py3-none-any.whl.
File metadata
- Download URL: elastly-0.1.0-py3-none-any.whl
- Upload date:
- Size: 81.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52998efb226532ce1db01d6079315603bfc304760c3deecc712eb55b5f5a3741
|
|
| MD5 |
b0cc0557ed2c8d6d22037a7e6ff66eb4
|
|
| BLAKE2b-256 |
76174879e32bd295bf332c532149f3c743992b7ff4075c26696831ebb88b4aaf
|
Provenance
The following attestation bundles were made for elastly-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on elastly/elastly-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
elastly-0.1.0-py3-none-any.whl -
Subject digest:
52998efb226532ce1db01d6079315603bfc304760c3deecc712eb55b5f5a3741 - Sigstore transparency entry: 2189818735
- Sigstore integration time:
-
Permalink:
elastly/elastly-python@9fdfd1a63de7b6aaf35be6c287ad3340c4313f8f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/elastly
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9fdfd1a63de7b6aaf35be6c287ad3340c4313f8f -
Trigger Event:
workflow_dispatch
-
Statement type: