def index(): try: bot.remove_webhook() bot.set_webhook(url="https://{}.herokuapp.com/{}".format( constants.appName, constants.token)) except Exception: print('Frontend only') return pages.main()
def fine(): """ res[url]['n'] = [pagename] res[url]['j'] = [pagename] """ p = pages.main() res = {} for pagename in p: for url in p[pagename]: if p[pagename][url]['url_pattern'] not in res.keys(): res[p[pagename][url]['url_pattern']] = {'j':[],'n':[]} if 'main' in p[pagename][url].keys(): res[p[pagename][url]['url_pattern']]['j'].append(pagename) #print pagename,url else: res[p[pagename][url]['url_pattern']]['n'].append(pagename) return res
def handle_root(self, client): self.wlan_sta.active(True) self.send_header(client) networks = self.wlan_sta.scan() wifi_list = [] count = 0 for ssid, _, _, rssi, _, _ in sorted(networks, key=lambda x: x[3], reverse=True): ssid = ssid.decode('utf-8') wifi_list.append([ssid, rssi, str(count)]) count += 1 client.sendall(pages.main(self.project_name, wifi_list)) client.close() return wifi_list
p = pages.main() res = {} for pagename in p: for url in p[pagename]: if p[pagename][url]['url_pattern'] not in res.keys(): res[p[pagename][url]['url_pattern']] = {'j':[],'n':[]} if 'main' in p[pagename][url].keys(): res[p[pagename][url]['url_pattern']]['j'].append(pagename) #print pagename,url else: res[p[pagename][url]['url_pattern']]['n'].append(pagename) return res QUERYPATTERN = getPattern('queryPattern.cfg') URL_PATTERN = pages.main() urlAll = fine() #NUMPATTERN = r"""/\d+\/?""" #numPattern = re.compile(NUMPATTERN) #URLPATTERN = [ # ['/plan/planid/cases/', r"""\/plan\/\d+\/cases\/?""",], # ['/plan/planID/planName/', r"""\/plan\/\d+\/{1}.*""",], # ['/accounts/username/recent/', r"""\/accounts\/.*?\/recent\/?""",], # ['/accounts/username/bookmarks/', r"""\/accounts\/.*?\/bookmarks\/?""",], # ['/accounts/username/profile/', r"""\/accounts\/.*?\/profile\/?""",], # #['/idnumber/', r"""/\d+\/?""",], # ] # #urlPattern = [] #for name,pattern in URLPATTERN:
def indexByUser(userId): return pages.main(userId)