异步python telegra.ph API包装器
aiograph的Python项目详细描述
aiograph-异步python telegra.ph API包装器。
注释
电报类(aiograph.Telegraph)将所有api调用封装在一个类中。 它提供创建页面、获取视图等功能,以及Telegra.ph/api页面中描述的其他方法
存储在包aiograph.types中的所有数据类型。
所有方法都是按照PEP-8指令命名的 例如,createAccount方法的create_account等。 所有api方法都是可等待的,只能在事件循环内调用。
另外,如果要将文件上载到telegra.ph服务,请使用upload方法 以电报课为例。
在所有操作结束时,您需要通过调用close()方法(可等待)来关闭http连接。
安装
使用pip
$ pip install -U aiograph
来源
$ git clone https://github.com/aiogram/aiograph.git
$ cd aiograph
$ python setup.py install
用法示例
importasynciofromaiographimportTelegraphloop=asyncio.get_event_loop()telegraph=Telegraph()asyncdefmain():awaittelegraph.create_account('aiograph-demo')page=awaittelegraph.create_page('Demo','<p><strong>Hello, world!</strong></p>')print('Created page:',page.url)if__name__=='__main__':try:loop.run_until_complete(main())except(KeyboardInterrupt,SystemExit):passfinally:loop.run_until_complete(telegraph.close())# Close the aiohttp.ClientSession
链接
- 新闻:@aiogram_live
- 社区:@aiogram
- 俄罗斯社区:@aiogram_ru
- 管道:aiograph
- 来源:Github repo
- 问题/错误跟踪程序:Github issues tracker