Closed gyro-needer closed 1 month ago
One debugging method I can suggest is to use an request printer (for example using netcat as nc -l 8080
) and send requests to this request printer to examine the difference in the requests sent by the 2 libraries. Also check up on #534
I ran this code on MicroPython 1.23 on the Unix port. It returns 200 OK with the webpage data. So it seems that this issue has been fixed.
import requests
headers={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36'}
url="https://www.zara.com"
response = requests.get(url, headers=headers)
assert response.status_code == 200, response.content
print(response.content)
Hi,
I am using Micropython's urequests module to access a website but it returns 403 Access Denied error. However, when I use Python's requests module to access the same website, it returns the actual content of the website.
When using urequests:
Returns:
b'<HTML><HEAD>\n<TITLE>Access Denied</TITLE>\n</HEAD><BODY>\n<H1>Access Denied</H1>\n \nYou don\'t have permission to access "http://www.zara.com/es/es/blazer-traje-estructura-p00706334.html?" on this server.<P>\nReference #18.c4d31102.1677369242.52175e1f\n</BODY>\n</HTML>\n'
When using Python's requests:
It returns the actual content of the website.
I've tried looking what could cause this problem but haven't been able to make urequests behave like requests.