Esempio n. 1
0
def gen_url(length):
    while True:
        url = ''.join(random.choice(string.ascii_lowercase + string.digits) \
                      for _ in range(length))
        try:
            database.get(url)
        except HTTPError:
            return url
Esempio n. 2
0
def gen_url(length):
    while True:
        url = ''.join(random.choice(string.ascii_lowercase + string.digits) \
                      for _ in range(length))
        try:
            database.get(url)
        except HTTPError:
            return url
Esempio n. 3
0
def urls(url=None):
    entry = database.get(url)
    url_link = '{}/u/{}'.format(PROD_URL, url)
    return render_template('urls.html', url_link=url_link, entry=entry)
Esempio n. 4
0
def urls(url=None):
    entry = database.get(url)
    url_link = '{}/u/{}'.format(PROD_URL, url)
    return render_template('urls.html', url_link=url_link, entry=entry)