I'm trying to automate publishing some texts in Telegram using Telegraph and Python. I need to make links that will be clickable on Telegraph.
I made this only for Telegraph file with one link. Here is the code:
from telegraph import Telegraph
from telegraph.utils import html_to_content
telegraph = Telegraph('<access_token>')
account = telegraph.create_account(short_name='216')
html_string = '<a href="https://www.hse.ru">school</a>'
content = html_to_content(html_string)
new_page = telegraph.create_page(title="Formed Digest", content=content)
print(new_page[1])
But I need to have some other text that will not be clickable.
Like mentioned in the comments, I don't see the picture of why there are two telegraph & telegraph_client libraries in use. Also unsure of where the html is getting created add. There's no relation with your question which is how to add a link in between text. Just giving you a sample html string below.
html_string = '<html>\n<head>\n<title> \nOutput Data in an HTML file \
</title>\n</head> <body><h1>Welcome to <a href="https://www.hse.ru">School!</a></h1>\
\nTesting out writing a second line</h2> \n</body></html>'
f= open("test.html","w+")
f.write(html_string);
f.close();