Skip to content

Instantly share code, notes, and snippets.

@janoelze
Forked from maxfriedrich/naturkosmetik.py
Last active December 17, 2015 16:09
Show Gist options
  • Save janoelze/5636588 to your computer and use it in GitHub Desktop.
Save janoelze/5636588 to your computer and use it in GitHub Desktop.
the script is now checking if the domain is already taken
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