modal implementation #12

Merged
vincent merged 10 commits from dev into master 2019-05-11 14:21:09 +00:00
Showing only changes of commit c32aa69b89 - Show all commits

View File

@ -2,12 +2,13 @@ from bs4 import BeautifulSoup
import urllib.request import urllib.request
import re import re
from datetime import datetime, timedelta from datetime import datetime, timedelta
from time import sleep
#debug #debug
#import pprint #import pprint
class Emmission(object): class Emmission(object):
loading = False
def __init__(self): def __init__(self):
self._LoadreferencePage() self._LoadreferencePage()
@ -19,11 +20,17 @@ class Emmission(object):
return None return None
print("load") print("load")
self.html = BeautifulSoup(response.read(),"html.parser") self.html = BeautifulSoup(response.read(),"html.parser")
self.timeexp=datetime.utcnow() +timedelta(minutes=5) self.timeexp=datetime.utcnow() +timedelta(seconds=30)
def parse_emmission(self,strsearch): def parse_emmission(self,strsearch):
if (datetime.utcnow() > self.timeexp): if ((datetime.utcnow() > self.timeexp) and (self.loading == False)):
self.loading = True
self._LoadreferencePage() self._LoadreferencePage()
self.loading = False
else:
while(self.loading):
sleep(0.1)
pass
strsearch=strsearch.replace('É','E') strsearch=strsearch.replace('É','E')
linkchaine=self.html.find(text=re.compile(re.escape(strsearch))) linkchaine=self.html.find(text=re.compile(re.escape(strsearch)))
if linkchaine == None: if linkchaine == None: