Hello!
I'm trying to "port" a simple script to send a notification using pushbullet from my esp8266.
Here is the original python code:
[code]
import requests
import json
body = "Corpo"
title = "Titolo"
data_send = {"type": "note", "title": title, "body": body}
API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxx"
resp = requests.post('https://api.pushbullet.com/v2/pushes', data=json.dumps(data_send), headers={'Authorization': 'Bearer ' + API_KEY, 'Content-Type': 'application/json'})
[/code]
if i replace requests with urequests and i try this code on esp8266 i get this error:
[code]
ssl_handshake_status: -256
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "urequests.py", line 104, in post
File "urequests.py", line 56, in request
OSError: [Errno 5] EIO
[/code]
I'm kinda new to micropython, i hope someone could help me understand more (or just send me in the right direction)
requests.post OSError: [Errno 5] EIO
Re: requests.post OSError: [Errno 5] EIO
I'm experiencing the same issues more or less.
I'm trying to send a request to a Telegram Bot and what I get is
I'm using uRequest.py library, but I tried also with uRequests.py and having the same issue.
This is the code I'm running:
I'm trying to send a request to a Telegram Bot and what I get is
Code: Select all
ssl_handshake_status: -261
Traceback (most recent call last):
File "main.py", line 10, in <module>
File "urequest.py", line 28, in urlopen
OSError: [Errno 5] EIO
I'm using uRequest.py library, but I tried also with uRequests.py and having the same issue.
This is the code I'm running:
Code: Select all
bot_id = "<bot_id>"
chat_id = <chat_id>
message = "This is a message".strip().replace(" ", "%20")
content = "chat_id=" + str(chat_id) + "&text=" + message
data = urequest.urlopen("https://api.telegram.org/bot" +
bot_id +
"/sendMessage",
content)
Re: requests.post OSError: [Errno 5] EIO
This could be because axTLS version used currently by uPy doesn't support ciphersuites of those sites. Feel free to build the latest axTLS and use its sample client to connect. If you confirm that works, that would help to raise the priority of the upgrade.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/
Re: requests.post OSError: [Errno 5] EIO
You might be right. According to this repo, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (cyphersuite used by api.telegram.org) is not supported.pfalcon wrote:This could be because axTLS version used currently by uPy doesn't support ciphersuites of those sites. Feel free to build the latest axTLS and use its sample client to connect. If you confirm that works, that would help to raise the priority of the upgrade.
However, it looks like google.com uses the same cyphersuite, so I don't understand why it works with google and not with Telegram. Also, I'm rather sure Google uses HSTS, so a cyphersuite downgrade shouldn't be possible.
Re: requests.post OSError: [Errno 5] EIO
I have the same issue (MicroPython v1.12 on 2019-12-20; ESP8266):
import urequests as u
req = u.get("https://api.telegram.org/bot<my_token>/ ... my_chat_id>")
, i get this:
ssl_handshake_status: -40
Traceback (most recent call last):
File "", line 1, in
File "urequests.py", line 149, in get
File "urequests.py", line 93, in request
OSError: [Errno 5] EIO
But for example, this works:
req = u.get("https://telegram-webhook-sample.herokuapp.com/")
Is there any solution for this issue? Or some other possibility to send get request to the Telegram?
Tnx in advance!
import urequests as u
req = u.get("https://api.telegram.org/bot<my_token>/ ... my_chat_id>")
, i get this:
ssl_handshake_status: -40
Traceback (most recent call last):
File "", line 1, in
File "urequests.py", line 149, in get
File "urequests.py", line 93, in request
OSError: [Errno 5] EIO
But for example, this works:
req = u.get("https://telegram-webhook-sample.herokuapp.com/")
Is there any solution for this issue? Or some other possibility to send get request to the Telegram?
Tnx in advance!
Re: requests.post OSError: [Errno 5] EIO
Just chiming in to say I have the same error as well, trying to send a post request to a slack webhook: https://hooks.slack.com/services/T00000 ... XXXXXXXXXXmradovan wrote: ↑Sun Oct 11, 2020 7:42 pmI have the same issue (MicroPython v1.12 on 2019-12-20; ESP8266):
import urequests as u
req = u.get("https://api.telegram.org/bot<my_token>/ ... my_chat_id>")
, i get this:
ssl_handshake_status: -40
Traceback (most recent call last):
File "", line 1, in
File "urequests.py", line 149, in get
File "urequests.py", line 93, in request
OSError: [Errno 5] EIO
But for example, this works:
req = u.get("https://telegram-webhook-sample.herokuapp.com/")
Is there any solution for this issue? Or some other possibility to send get request to the Telegram?
Tnx in advance!
Has anyone discovered a fix for this?
-
- Posts: 4
- Joined: Sat May 28, 2022 3:47 pm
Re: requests.post OSError: [Errno 5] EIO
I have the same problem on Raspberry pi pico. Have you already solved it? Or could anyone help?mradovan wrote: ↑Sun Oct 11, 2020 7:42 pmI have the same issue (MicroPython v1.12 on 2019-12-20; ESP8266):
import urequests as u
req = u.get("https://api.telegram.org/bot<my_token>/ ... my_chat_id>")
, i get this:
ssl_handshake_status: -40
Traceback (most recent call last):
File "", line 1, in
File "urequests.py", line 149, in get
File "urequests.py", line 93, in request
OSError: [Errno 5] EIO
But for example, this works:
req = u.get("https://telegram-webhook-sample.herokuapp.com/")
Is there any solution for this issue? Or some other possibility to send get request to the Telegram?
Tnx in advance!
I can send requests to other sites, but it is not working with telergam.