Skip to content

How to upload files (images, etc.) #30

Description

@vovkapultik

It's not an issue, I just want to share this code

fromtelegraphimportTelegraph, uploadtelegraph=Telegraph()
telegraph.create_account(short_name='LetsTry')
defpost(title, content):
response=telegraph.create_page(title,
html_content=content)
return'https://telegra.ph/{}'.format(response['path'])
files='/Users/vovkapultik/Downloads/52920087_159420908268041_6560105268061929472_n.jpg'imgpath=upload.upload_file(files)
print(imgpath)
#['/file/02a1613fc106b225b2b74.jpg']postlink=post('Title', '<img src="/file/02a1613fc106b225b2b74.jpg">')
print(postlink)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions