Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4104

Python • Issues with Micropython on Pico W with Sonoff Light Bulb

$
0
0
Hi everyone. I'm having a bit of an issue with Micropython.

I've tried urequests and the regular requests library to no avail.

I keep getting a bad status line error. I can't really find much info on this error pertaining specifically to RPi, which is why I'm posting.

I can't post code at the moment, but here's an overview.

The URL for the REST API is correct. I tested it using Chrome on my laptop using an API tester extension. I was able to successfully turn the light on and off.

But when I use the exact same URL in Micropython, I get the bad status line error. GET and POST.

I read about raising an error and catching it in a try..exception but then I get an error saying that requests.exceptions doesn't exist. Same for urequests.

So I can't even really debug this.

I also tried adding headers to the request to mimic a desktop client in case the bulb server was rejecting the requests but still nothing.

I can request other URLs just fine.

Adding a timeout to the request made me encounter an enomem.

Am I missing something? Again, I'll post code shortly but I'm wondering if there's literally ANYONE else out there who has ever had a similar issue on the Pico W.

Statistics: Posted by RYoder97 — Sat Oct 05, 2024 3:53 am



Viewing all articles
Browse latest Browse all 4104

Trending Articles