Click here to Skip to main content
15,042,814 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I'm new to python and working on a python project that checks username availability on I'm trying to do this by entering a wordlist of possible usernames and letting the code check wether the site gives a 200- or a 404 status code, with 404 being a Unavailable username and 200 an Available username. When I run the code I get this traceback error message:
Traceback (most recent call last):
  File "C:\Users\Gibbo\OneDrive\Bureaublad\uPlay\", line 7, in <module>
    response = urllib.response.status_code("")
AttributeError: module 'urllib.response' has no attribute 'status_code'

And here's the code:
import pyfiglet
import datetime
import urllib.request
import urllib
import requests

url = ""
response = urllib.response.status_code("")


url = ""
available = "available.txt"
users = "usernames.txt"
now = ()
if response.status_code == 200:
elif response.status_code == 404:

def initialize():
    ascii_banner = pyfiglet.figlet_format("Made  By  Gxzs!!")
    print(f"{count()} usernames detected")
    print("Press ENTER to begin checking")

What I have tried:

I've tried nothing yet as i can't identify the problem as I have little python experience
Updated 6-May-21 6:38am

1 solution

The urllib.response method does not contain an attribute called status_code. See the documentation at urllib.request — Extensible library for opening URLs — Python 3.9.5 documentation[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900