Skip to content

Instantly share code, notes, and snippets.

@maxfriedrich
Forked from janoelze/naturkosmetik.py
Last active December 17, 2015 16:09
Show Gist options
  • Save maxfriedrich/5636830 to your computer and use it in GitHub Desktop.
Save maxfriedrich/5636830 to your computer and use it in GitHub Desktop.
So.
from random import randint
import urllib2
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()
if not exists('http://%s.com' % name):
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