semvec/pypi-packages huggingface dataset:
tianyancha 0.2.1
Tianyancha SDK for python, which based on https://open.tianyancha.com/
License: MIT
Requires Python: >=3.6.0


# tianyancha - 天眼查 API

Tianyancha SDK for python, which based on https://open.tianyancha.com/

## install

```shell script
pip install tianyancha
```

## Usage

All API supported! please visit **[Supported methods](API.md)** for more information!

```python
from tianyancha import Tianyancha

token = "TOKEN"
word = "北京百度网讯科技有限公司"
tyc = Tianyancha(token)
ret = tyc.search(word=word)  # Limited to use `keyword arguments`
```

```json
{
  "error_code": 0,
  "reason": "ok",
  "result": {
    "items": [
      {
        "regNumber": "110108002734659",
        "regStatus": "在业",
        "creditCode": "91110000802100433B",
        "estiblishTime": "2001-06-05 00:00:00.0",
        "regCapital": "1342128万人民币",
        "companyType": 1,
        "name": "<em>北京百度网讯科技有限公司</em>",
        "id": 22822,
        "orgNumber": "802100433",
        "type": 1,
        "base": "北京",
        "legalPersonName": "梁志祥"
      },
      {
        "regNumber": "440106000623068",
        "regStatus": "在业",
        "creditCode": "91440101675657502F",
        "estiblishTime": "2008-05-20 00:00:00.0",
        "regCapital": "-",
        "companyType": 1,
        "name": "<em>北京百度网讯科技有限公司</em>广州分公司",
        "id": 139572971,
        "orgNumber": "675657502",
        "type": 1,
        "base": "广东",
        "legalPersonName": "沈抖"
      },
      ...
    ],
    "total": 56
  }
}
```

## More usages

Request APIs as below, they are equal:

```python
ret1 = tyc.get('ic/changeinfo/2.0', {'keyword': keyword})
ret2 = tyc.ic_changeinfo(keyword=keyword)
```

Sync newest APIs from official website and update document.

```shell
python tianyancha/sync.py > API.md
```

## Tests

just run `pytest`

## Changelog

* 2024-09-23 0.2.1 sync new methods from tianyancha.com
* 2020-12-11 0.1.2 path bugfix and generate documents for all methods
* 2020-12-11 0.1.1 support all methods
* 2020-12-11 0.1.0 support basic search for tianyancha

## Refs

Official API Document: https://open.tianyancha.com/api_list
pokepy-sdk 0.1.0
Python library for interacting with the `pokeapi` API
License: MIT
Requires Python: <4.0,>=3.8

# PokeAPI SDK

A Python SDK for PokeAPI, providing easy access to Pokémon data.

## Installation
Install `pokepy_sdk` with Python's `pip` package manager:
`pip install pokeapi-sdk`

## Usage
First, instantiate a client:```
from pokeapi_sdk.client import PokeAPIClient
client = PokeAPIClient()
```

With a `PokeAPIClient` object:
- 1: Get a Pokémon by name (str) or ID (int)
```
pokemon = client.get_pokemon("pikachu")
print(pokemon.name, pokemon.abilities)
```
This returns a `Pokemon` object.

- 2: Get a generation by name (str) or ID (int)
```
generation = client.get_generation(1)
print(generation.name, generation.pokemon_species)
```
This returns a `Generation` object.

- 3: Get a summary of every Pokemon:
```
all_pokemon = client.get_all_pokemon_summaries()
```
This returns a list of `PokemonSummary` objects.

- 4: Get a summary of every Generation:
```
all_generations = client.get_all_generation_summaries()
```
This returns a list of `GenerationSummary` objects.

Both `get_all_pokemon_summaries()` & `get_all_generation_summaries()` support optional offset-based pagiation parameters:
- `offset`: The starting point within the collection 
- `page_size`: The maximum number of objects to return in the request

## Testing

To run the unit tests:
`pytest`

To run the integration tests:
`pytest pokep_sdky/tests/integration_tests.py`

## Design Decisions 
- **Pagination**: Optional offset-based pagination is supported when fetching all Pokemon & all Pokemon generations. 
- **Pydantic data validation**: Pydantic provides excellent validation tools for instantiation of class instances
- **Error Handling**: Comprehensive HTTP error handling for all requests
- **Abstractions**: Significant use of classes & a client object to simplify user experience
- **Package management with Poetry**: Poetry provides intuitive dependency & package management
- **Rate Limit Handling**: PokeAPI does not currently impose API rate limits, but a simple rate limit handler has been included for all requests
- **`__str__` & `__repr__` overrides**: For improved informational display of class instances

## Tools Used
- `black` formatter: https://github.com/psf/black
- `ruff` linting & formatting: https://docs.astral.sh/ruff/
- `mypy` for static type checking: https://github.com/python/mypy
- `pytest` for unit test & integration tests https://docs.pytest.org/en/stable/
- `tenacity` for handling rate limiting: https://github.com/jd/tenacity