a3rbly-api
A small Python client for the A3rbly Arabic grammar parsing and diacritization API. It uses the standard library and works with Python 3.9 and newer.
Get an API key
Get your API key from a3rbly.com. Keep it private; do not commit it to source control or place it in client-side code.
Install
pip install a3rbly-api
Quick start
Pass the key to the client:
from a3rbly import A3rblyClient
client = A3rblyClient(api_key="YOUR_A3RBLY_API_KEY")
parsed = client.parse("قرأ الطالب الكتاب")
print(parsed)
vocalized = client.diacritize("قرأ الطالب الكتاب")
print(vocalized)
Or set an environment variable so the key stays out of your source code:
export A3RBLY_API_KEY="YOUR_A3RBLY_API_KEY"
from a3rbly import A3rblyClient
client = A3rblyClient()
print(client.i3rab("قرأ الطالب الكتاب"))
API methods
| Python method | HTTP request | Description |
|---|---|---|
client.parse(sentence) |
POST /i3rab |
Parses a sentence. Sends {"prompt": "..."}. |
client.i3rab(sentence) |
POST /i3rab |
Alias for parse. |
client.diacritize(text) |
GET /diacritize?text=... |
Adds diacritics to Arabic text. |
The base URL defaults to https://api.a3rbly.com. Each method returns the
decoded JSON response as a Python dictionary. The client sends the key in both
the x-api-key and Authorization: Bearer ... headers.
Errors
All client errors derive from A3rblyError:
A3rblyAuthenticationErrorfor HTTP 401 or 403A3rblyRateLimitErrorfor HTTP 429A3rblyAPIErrorfor other unsuccessful or malformed API responsesA3rblyConnectionErrorwhen the API cannot be reached
from a3rbly import A3rblyAPIError, A3rblyClient
client = A3rblyClient() # Reads A3RBLY_API_KEY from the environment
try:
result = client.parse("الطالب مجتهد")
except A3rblyAPIError as error:
print(error.status_code, error.code, error)
The request timeout defaults to 30 seconds and can be changed when creating
the client: A3rblyClient(timeout=10).
Build for PyPI
From this directory, build the wheel and source archive with:
python -m pip install build
python -m build
Choose the package license and PyPI account credentials before publishing the
generated files in dist/.
API reference
The live API schema is available at api.a3rbly.com/openapi.json.
Metadata
Release files for a3rbly-api 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| a3rbly_api-0.1.0.tar.gz | 4.6 kB | Without provenance | Details for a3rbly_api-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| a3rbly_api-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for a3rbly_api-0.1.0-py3-none-any.whl |
Total release size: 9.9 kB
Release files / a3rbly_api-0.1.0.tar.gz
| Download URL | a3rbly_api-0.1.0.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3b1059bd5750b9175be749fa6f9f275c66295a0d860cf1467e3a4aa67be9300
|
|
BLAKE2b-256 checksum How to use checksums |
29359f3e8da9ffad6fb8cae071dfbbdfe0672fe3b84a3c4f9acc17f0b611559b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / a3rbly_api-0.1.0-py3-none-any.whl
| Download URL | a3rbly_api-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
517927ed27041949f3f627a31d0928c509ddb715b3b45c820f919f736575bcc2
|
|
BLAKE2b-256 checksum How to use checksums |
0fb36d472afc357ecb93924cc51f8da36a1fcf1bad19f8faf81ce49204dba25c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for a3rbly-api 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.