异步PythonTelegra公司API包装
aiographfix的Python项目详细描述
aiographix-异步PythonTelegra.ph.公司API包装,修复aiograph
注释
Telegraph类(aiographfix.Telegraph)将所有API调用封装在一个类中。 它提供诸如create_page、get_views和Telegra.ph/api页中描述的其他方法等函数
存储在包aiographfix.types中的所有数据类型。在
所有方法都是按照PEP-8指令命名的 例如create_accountfor createAccount方法等。 所有API方法都是可等待的,只能在事件循环内调用。在
如果要将文件上载到Telegra.ph.公司服务使用upload方法 以电报课为例。在
在所有操作结束时,您需要通过调用close()方法来关闭HTTP连接(等待)。在
安装
使用PIP
$ pip install -U aiographfix
来源
^{pr2}$使用示例
importasynciofromaiographfiximportTelegraphloop=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
- 点:aiographfix
- 来源:Github repo
- 问题/错误跟踪程序:Github issues tracker
- 项目
标签: