Hello! It is necessary to publish an article in the Telegra.ph service using Python. Tried to do this with the "telegraph" and "python-telegraphapi" modules, but without success. I tried to just run the code that is attached to the "telegraph" module instructions, as a sample:
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'])) Produces this error:
File "AutoContent.py", line 6, in <module> html_content='<p>Hello, world!</p>' File "C:\Program Files\Python36\lib\site-packages\telegraph\api.py", line 168, in create_page 'return_content': return_content File "C:\Program Files\Python36\lib\site-packages\telegraph\api.py", line 40, in method raise TelegraphException(response.get('error')) telegraph.exceptions.TelegraphException: PAGE_SAVE_FAILED I tried the sample code of the module "python-telegraphapi":
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'])) It turns out this error:
File "AutoContent.py", line 4, 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 I do not even know where to look to solve the problem. Please, help!