urequests object with buffer protocol required
Posted: Tue Mar 30, 2021 4:14 pm
I'm trying to get a program to push a notification to my phone via pushbullet. I found some code that supposedly works(or worked at some time) and get an error:
File "C:\Users\jobla\Documents\Micropython-Projects\workSpace\RNT-ESP32-ESP8266\visitorpush.py", line 87, in <module>
File "C:\Users\jobla\Documents\Micropython-Projects\workSpace\RNT-ESP32-ESP8266\visitorpush.py", line 63, in visitornotify
File "/lib/urequests.py", line 115, in post
File "/lib/urequests.py", line 68, in request
TypeError: object with buffer protocol required
The relevant request is:
def visitornotify():
r = urequests.post(
'https://api.pushbullet.com/v2/pushes',
#data=json.dumps(data_sent),
#'Host':'api.pushbullet.com',
data=data_sent,
headers=pb_headers)
Line 53 is the 'https....' line.
data_sent = {"type": "note", "title": title, "body": body}
Don't know how to fix this...anyone have some wisdom to share on this?
Thanks.
File "C:\Users\jobla\Documents\Micropython-Projects\workSpace\RNT-ESP32-ESP8266\visitorpush.py", line 87, in <module>
File "C:\Users\jobla\Documents\Micropython-Projects\workSpace\RNT-ESP32-ESP8266\visitorpush.py", line 63, in visitornotify
File "/lib/urequests.py", line 115, in post
File "/lib/urequests.py", line 68, in request
TypeError: object with buffer protocol required
The relevant request is:
def visitornotify():
r = urequests.post(
'https://api.pushbullet.com/v2/pushes',
#data=json.dumps(data_sent),
#'Host':'api.pushbullet.com',
data=data_sent,
headers=pb_headers)
Line 53 is the 'https....' line.
data_sent = {"type": "note", "title": title, "body": body}
Don't know how to fix this...anyone have some wisdom to share on this?
Thanks.