Last active
February 3, 2024 08:28
-
-
Save sht/6295cb74489545d1c429eab7bfa5f9d4 to your computer and use it in GitHub Desktop.
to check weather a given username in the file exist on github or not
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string, random, requests, json | |
def generateUser(size=3, chars=string.ascii_lowercase + string.digits): | |
return ''.join(random.choice(chars) for _ in range(size)) | |
for x in range(200): | |
user = generateUser() | |
try: | |
jsonData = json.loads( | |
requests.get(f"https://api.github.com/users/{user}").text | |
) | |
print (jsonData['login'] + ' exist, created at: ' + jsonData['created_at'][:-10]) | |
except Exception as e: | |
print (f'User: {user}, does not exist\n') | |
exit() |
check if a given github username is available or not
Sample output:
DU9 exist, created at: 2019-05-16
1XM exist, created at: 2017-06-01
User: u4t, does not exist
uto exist, created at: 2011-01-05
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample output: