Metadata-Version: 2.5
Name: usepylon
Version: 0.1.0a3
Summary: Official Python SDK for the Pylon API
Project-URL: Homepage, https://usepylon.com
Project-URL: Documentation, https://docs.usepylon.com
Project-URL: Repository, https://github.com/pylon-labs/pylon-python
Author: Pylon
License-Expression: MIT
License-File: LICENSE
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: httpx<1,>=0.21.2
Requires-Dist: pydantic>=1.9.2
Requires-Dist: typing-extensions>=4.0.0
Provides-Extra: aiohttp
Requires-Dist: aiohttp<4,>=3.10.0; extra == 'aiohttp'
Requires-Dist: httpx-aiohttp==0.1.8; extra == 'aiohttp'
Description-Content-Type: text/markdown

# Pylon Python SDK

The official Python SDK for the [Pylon API](https://docs.usepylon.com).

> **Alpha.** The SDK is new and its interface may change between `0.x` releases.

## Installation

```bash
pip install usepylon
```

Requires Python 3.9 or later.

## Usage

```python
from usepylon import Pylon
from usepylon.environment import PylonEnvironment

client = Pylon(token="YOUR_API_TOKEN")

issue = client.issues.get("issue_id").data

# List methods page through results automatically.
for account in client.accounts.list():
    print(account.name)
```

Pylon accounts live in either the US or the EU region, and the client defaults to the US. EU accounts must select the EU region:

```python
client = Pylon(token="YOUR_API_TOKEN", environment=PylonEnvironment.EU)
```

`AsyncPylon` has the same methods for use with `asyncio`.

### Errors

Requests that fail raise a subclass of `ApiError` carrying the status code and response body:

```python
from usepylon.core.api_error import ApiError

try:
    client.issues.get("missing")
except ApiError as error:
    print(error.status_code, error.body)
```

## Reference

[reference.md](reference.md) documents every method. The [Pylon API documentation](https://docs.usepylon.com) covers the underlying endpoints.

## Contributing

This SDK is generated from Pylon's OpenAPI spec, so changes to `src/usepylon` are overwritten by the next sync. Please open an issue for bugs or missing endpoints.
