Skip to main content

Chat client

Project description

Version Supported Python Version Downloads


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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ttclient-0.4.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ttclient-0.4-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file ttclient-0.4.tar.gz.

File metadata

  • Download URL: ttclient-0.4.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for ttclient-0.4.tar.gz
Algorithm Hash digest
SHA256 7aff04395faa08c289933931bfeab5859eb1e4e724cf61fc05dc6cb534a218a2
MD5 95870c58e3d6cde84a7bb6ac81c45fcd
BLAKE2b-256 793ee4c4730cc380e5b17e9a91638956e322b899bd82a9bcca00eff003c18ffe

See more details on using hashes here.

File details

Details for the file ttclient-0.4-py3-none-any.whl.

File metadata

  • Download URL: ttclient-0.4-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for ttclient-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 62ec4fff98e622d7e31aff289e975c4d9f08b31801790b013eabbd2e2af1c6a4
MD5 8d993f70c35e99f66636d65b052bb63b
BLAKE2b-256 67f19c3a1b865ca5d0ff21181ef145ed08764025d9a064c248cbdb8b7c72b88a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page