我想发布一个Telegra.ph.公司文章使用Python和Telegraph API。我试过电报和python telegraphapi模块,但我做不到。我尝试使用模块的示例代码:
from telegraph import Telegraph
telegraph = Telegraph()
telegraph.create_account(short_name='1337')
response = telegraph.create_page(
'Hey',
html_content='<p>Hello, world!</p>'
)
print('http://telegra.ph/{}'.format(response['path']))
接下来是:
^{pr2}$另一个代码:
from telegraphapi import Telegraph
telegraph = Telegraph()
telegraph.createAccount("PythonTelegraphAPI")
page = telegraph.createPage("Hello world!", html_content="<b>Welcome, TelegraphAPI!</b>")
print('http://telegra.ph/{}'.format(page['path']))
发生了什么:
File "AutoContent.py", line 6, in <module>
page = telegraph.createPage("Hello world!", html_content="<b>Welcome, TelegraphAPI!</b>")
File "C:\Program Files\Python36\lib\site-packages\telegraphapi\main.py", line 139, in createPage
"return_content": return_content
File "C:\Program Files\Python36\lib\site-packages\telegraphapi\main.py", line 32, in make_method
post_request.json()['error'])
telegraphapi.exceptions.TelegraphAPIException: Error while executing createPage: PAGE_SAVE_FAILED
求你了,帮帮我!如何使用Python发布电报文章?在
使用API有两种不同的解决方案。在
我认为您应该在您的}:
create_account
时替换{telegraph.create_account(short_name='<your_name>')
相关问题 更多 >
编程相关推荐