Click here to Skip to main content
15,031,219 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 Ubisoft.com. 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\usernamess.py", line 7, in <module>
    response = urllib.response.status_code("https://ubisoftconnect.com/en-US/profile/")
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 = "https://ubisoftconnect.com/en-US/profile/"
response = urllib.response.status_code("https://ubisoftconnect.com/en-US/profile/")

print(r.status_code)

url = "https://ubisoftconnect.com/en-US/profile/"
available = "available.txt"
users = "usernames.txt"
now = datetime.datetime.now ()
if response.status_code == 200:
    print('Available')
elif response.status_code == 404:
    print('Unavailable')


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


What I have tried:

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

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