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

BadStatusLine Error #19

Open
GM-Script-Writer-62850 opened this issue Jan 17, 2023 · 1 comment
Open

BadStatusLine Error #19

GM-Script-Writer-62850 opened this issue Jan 17, 2023 · 1 comment

Comments

@GM-Script-Writer-62850
Copy link

Board: W5500-EVB-PICO
FW: v2.0.0 firmware.uf2

Several times during testing while using the urequests library i get a BadStatusLine Error in Thonny, the line below this error message is [] after checking my server log files a 200 status code was sent

try:
	if not data:
		r=urequest.get(page)
	else:
		r=urequest.post(page,data=json_encode(data),headers={"Content-type":"application/json"})
except BadStatusLine:
	#No idea why this happens, line is returned as []
	#My server log files disagree
	print("ERROR: BadStatusLine; Ignore")
except Exception as e:
	print("ERROR:",e)

in my use case i have a input polling loop running on core 0 and uasyicio running on core 1 via _thread, urequests is called from core 1

@GM-Script-Writer-62850
Copy link
Author

managed to log a error

urequest ERROR: HTTP error: BadStatusLine:
[]
Wiz CREG:
  0000: 00 0a 00 00 01 ff ff ff 00 02 a4 8f 74 61 9a 0a
  0010: 00 00 af 00 00 00 00 02 00 07 d0 08 28 00 00 00
  0020: 00 00 00 00 00 00 ff ff 00 00 00 00 00 00 bf 00
  0030: 00 00 00 00 00 00 00 78 25 04 00 00 00 00 00 00
  0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Wiz SREG[0]:
  0000: 01 00 00 00 c0 01 00 d8 61 55 c0 93 0a 00 00 45
  0010: 1f 90 05 b4 00 00 80 00 00 00 00 00 00 00 02 02
  0020: 08 00 fd e9 fd e9 01 b7 00 00 01 b7 ff 40 00 00
Wiz SREG[1]:
  0000: 02 00 04 22 00 44 ff ff ff ff ff ff 0a 00 00 af
  0010: 13 88 05 c0 00 00 80 00 00 00 00 00 00 00 02 02
  0020: 08 00 04 59 04 59 00 00 02 68 02 68 ff 40 00 00
Wiz SREG[2]:
  0000: 00 00 00 00 00 00 ff ff ff ff ff ff 00 00 00 00
  0010: 00 00 00 00 00 00 80 00 00 00 00 00 00 00 02 02
  0020: 08 00 00 00 00 00 00 00 00 00 00 00 ff 40 00 00
Wiz SREG[3]:
  0000: 00 00 00 00 00 00 ff ff ff ff ff ff 00 00 00 00
  0010: 00 00 00 00 00 00 80 00 00 00 00 00 00 00 02 02
  0020: 08 00 00 00 00 00 00 00 00 00 00 00 ff 40 00 00
None
def http(page,data=False,err=False):
	if not err:
		page="http://10.0.0.69:8080/"+page
	if not GPIO.nic.isconnected():
		print("----------NO NETWORK----------")
		return False
	try:
		if not data:
			r=urequest.get(page)
		else:
			r=urequest.post(page,data=json_encode(data),headers={"Content-type":"application/json"})
	except Exception as e:
		print("urequest ERROR:",e)
		print(GPIO.nic.regs())
		return False
	if r.status_code == 200 and r.content == b"OK":
		r.close()
		r=True
	else:
		r.close()
		r=False
	return r

If it matters http was called from core 1

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

1 participant