TTClient
Клиент для АПИ чата
INSTALL
Достаточно установить библиотеку ttclient
$ pip install ttclient
USAGE
Basic usage
base_client = BaseClient('YOUR_API_SECRET', host='YOUR_API_HOST')
data = await base_client.get('/user/me')
Uri template use arguments for formatting, arguments must be string or integer
data = await base_client.get('/core/chat/{}', chat_id)
Keywords convert to query string for GET and DELETE methods
and to json for POST, PUT, PATCH
data = await base_client.get('/core/chat', ids=','.join({chat1_id, chat2_id}))
data = await base_client.post('/core/chat', title='Title', org_visible=True)
data = await base_client.put('/core/chat/{}', chat_id, title='Title', org_visible=True)
data = await base_client.delete('/core/chat/{}', chat_id)
data = await base_client.patch('/user/settings', push_resend=True)
Extending client
class MyClient(BaseClient):
async def my_name(self) -> str:
data = await self.get('/user/me')
self.log.debug('Client data %s', str(data))
return data['name']
client = MyClient('YOUR_API_SECRET', host='YOUR_API_HOST')
name = await client.my_name()
Release files for ttclient 0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ttclient-0.4.tar.gz | 10.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ttclient-0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.2 kB
Release files / ttclient-0.4.tar.gz
| Download URL | ttclient-0.4.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7aff04395faa08c289933931bfeab5859eb1e4e724cf61fc05dc6cb534a218a2
|
|
BLAKE2b-256 checksum How to use checksums |
793ee4c4730cc380e5b17e9a91638956e322b899bd82a9bcca00eff003c18ffe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.1
|
Release files / ttclient-0.4-py3-none-any.whl
| Download URL | ttclient-0.4-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
62ec4fff98e622d7e31aff289e975c4d9f08b31801790b013eabbd2e2af1c6a4
|
|
BLAKE2b-256 checksum How to use checksums |
67f19c3a1b865ca5d0ff21181ef145ed08764025d9a064c248cbdb8b7c72b88a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.1
|