def GET(self, path): shortener = Shortener() click_info = ClickInfo() url = shortener.get_url(path) if url: click_info.save_click(web.ctx.env, path) web.redirect(shortener.format_url(url['url'])) web.notfound
def GET(self, code): shortener = Shortener() url = shortener.get_url(code) if url: img = qrcode.make(shortener.format_url(server_name+url['code'])) file = cStringIO.StringIO() img.save(file, 'png') image_code = file.getvalue() file.close() return image_code return ''
def GET(self): shortener = Shortener() input_params = web.input() data = {} if 'url' in input_params: url = input_params.url links = Links(server_name) shorted_url = shortener.short_it(url) links.add_link('url', param =shorted_url) links.add_link('statistic', param =shorted_url) links.add_link('qrcode', param = shorted_url) for element in links.get_links(): data[element['link']] = element['url'] data['menu'] = helper.main_menu() return render.main(params = data)