Metadata-Version: 2.4
Name: cardanoscan-python
Version: 0.0.2
Summary: Python SDK for Cardanoscan API
License-Expression: Apache-2.0
Project-URL: Homepage, https://cardanoscan.io/api
Project-URL: Documentation, https://docs.cardanoscan.io
Project-URL: Repository, https://github.com/StricaHQ/cardanoscan-python
Keywords: cardanoscan,cardano,cardano api,stricahq
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.23.0
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-asyncio; extra == "test"
Requires-Dist: respx; extra == "test"
Dynamic: license-file

<p align="center">
  <a href="https://strica.io/" target="_blank">
    <img src="https://docs.strica.io/images/logo.png" width="200">
  </a>
</p>

# cardanoscan-python
Python SDK for the Cardanoscan API, supporting both async and sync usage for accessing Cardano blocks, addresses, transactions, governance, analytics and more.

<p align="center">
  <a href="#installation">Installation</a> •
  <a href="#usage">Usage </a> •
  <a href="https://docs.cardanoscan.io/" target="_blank">API Documentation</a>
</p>

# Installation
[![PyPI - Version](https://img.shields.io/pypi/v/cardanoscan-python?label=PyPi%20Latest)](https://pypi.org/project/cardanoscan-python/)

Install SDK from PyPi

```sh
python3 -m pip install cardanoscan-python
```

# Usage

### Create a client

```python
from cardanoscan import Cardanoscan

client = Cardanoscan(api_key="YOUR_API_KEY")
```

### Sync Usage

```python
from cardanoscan import Cardanoscan

client = Cardanoscan(api_key="YOUR_API_KEY")

params = {
    "address": "addr1qxmj3a04rlp95k7428zznkq5ha4ccxwtf5gxught8ykh68l5pfacpmrk44mrauz57eak8m0aes2ywykct2puns9dzj7swe9z76"
}

data = client.get_address_balance_sync(params=params)

print(data)
```

### Async Usage

```python
import asyncio
from cardanoscan import Cardanoscan

async def main():
    client = Cardanoscan(api_key="YOUR_API_KEY")

    params = {
        "address": "addr1qxmj3a04rlp95k7428zznkq5ha4ccxwtf5gxught8ykh68l5pfacpmrk44mrauz57eak8m0aes2ywykct2puns9dzj7swe9z76"
    }

    data = await client.get_address_balance(params=params)
    print(data)

    await client.aclose()

asyncio.run(main())
```

### Using Query Parameters

All optional parameters are passed via params and sent as query parameters.

```python
params = {
    "address": "addr1...",
    "limit": 50,
    "pageNo": 100
}

data = client.get_transaction_list_by_address_sync(params=params)
```

# Development

Install Dependencies
```sh
python3 -m pip install -e .[tests]
```

Run Tests
```sh
python3 -m pytest
```
or with logs
```sh
python3 -m pytest -s
```
