Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upload_file Error #55

Open
Haruto-hyuuga opened this issue Aug 5, 2023 · 2 comments
Open

upload_file Error #55

Haruto-hyuuga opened this issue Aug 5, 2023 · 2 comments

Comments

@Haruto-hyuuga
Copy link

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)

@PavelKucherenko
Copy link

PavelKucherenko commented Aug 10, 2023

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.

@Haruto-hyuuga
Copy link
Author

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}

Sasivarnasarma added a commit to Sasivarnasarma/telegraph that referenced this issue Apr 5, 2024
Issues python273#56 , python273#55 , python273#47 Fixed.
Added New Exception.
 __init__ file improved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants