17👍
✅
You replaced the request object passed to your view by a local variable in the line
request = urllib.request.Request(NASDAQ, None, headers) # The assembled request
Name this variable something else. Like
assembled_request = urllib.request.Request(NASDAQ, None, headers) # The assembled request
response = urllib.request.urlopen(assembled_request)
2👍
You have reassigned django’s request with the return value from urllib, which is why your other lines are not working:
request = urllib.request.Request(NASDAQ, None, headers)
Change the above line so that it evaluates to something other than request
.
Source:stackexchange.com