telegraph icon indicating copy to clipboard operation
telegraph copied to clipboard

upload_file Error

Open Haruto-hyuuga opened this issue 2 years ago • 2 comments

File "/usr/local/lib/python3.8/site-packages/telegraph/upload.py", line 13, in upload_file r = TelegraphApi().upload_file(f) File "/usr/local/lib/python3.8/site-packages/telegraph/api.py", line 56, in upload_file response = self.session.post( File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 975, in json RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Haruto-hyuuga avatar Aug 05 '23 12:08 Haruto-hyuuga

I have the same issue today when I try to upload .jpg file.. Does anybody know the solution? Thanks in adance!

UPD: Solved for now when I turned off my VPN.. Don't know why, VPN works fine for browsing etc.

PavelKucherenko avatar Aug 10 '23 10:08 PavelKucherenko

I have the same issue today when I try to upload .jpg file.. Does anybody know the solution? Thanks in adance!

UPD: Solved for now when I turned off my VPN.. Don't know why, VPN works fine for browsing etc.

I have the same issue today when I try to upload .jpg file.. Does anybody know the solution? Thanks in adance!

UPD: Solved for now when I turned off my VPN.. Don't know why, VPN works fine for browsing etc.

You can use try and except block, like try to upload_file Except use httpx/aiohttp Libraray as client to upload file to telegraph.ph like "https://telegra.ph/upload", data={"upload-file": your-file}

Haruto-hyuuga avatar Aug 10 '23 11:08 Haruto-hyuuga

Close

Haruto-hyuuga avatar Jul 07 '24 02:07 Haruto-hyuuga