I want to get the response code from a web server, but sometime I get code 200 even if the page doesn't exist and I don't know how to deal with it.
I'm using this code:
def checking_url(link):
try:
link = urllib.request.urlopen(link)
response = link.code
except urllib.error.HTTPError as e:
response = e.code
return response
When I'm checking a website like this one: https://www.wykop.pl/notexistlinkkk/
It still returns code 200 even if the page doesn't exist. Is there any solution to deal with it?
I found solution, now gonna test it with more websites I had to use http.client.