-
-
Save janoelze/5636588 to your computer and use it in GitHub Desktop.
the script is now checking if the domain is already taken
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
from random import randint | |
import httplib | |
def get_name(silben = 3): | |
name = '' | |
vokale = ['a', 'e', 'i'] | |
konsonanten = ['d', 'l', 'v', 'w'] | |
for i in range(silben): | |
k = konsonanten[randint(0, len(konsonanten)-1)] | |
v = vokale[randint(0, len(vokale)-1)] | |
name += k + v | |
r = randint(0, 4) | |
if r > 3: | |
name += 'r' | |
return name | |
def exists(url): | |
try: | |
f = urllib2.urlopen(urllib2.Request(url)) | |
return True | |
except: | |
return False | |
def main(): | |
name = '' | |
while True: | |
name = get_name() | |
domain_exists = True | |
if exists('http://%s.com' % name) is True: | |
domain_exists = True | |
else: | |
return 'http://%s.com/' % name | |
if __name__ == '__main__': | |
print main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment