[whois] update module
* change intra-bocal URL to fix CertificateError * fix 23.tf trombi URL * add a catch when trying trombi URL
This commit is contained in:
parent
4cb8b0f1a6
commit
7a1ad6430c
1 changed files with 7 additions and 4 deletions
|
@ -49,11 +49,14 @@ class Login:
|
|||
def get_photo(self):
|
||||
if self.login in context.data.getNode("pics").index:
|
||||
return context.data.getNode("pics").index[self.login]["url"]
|
||||
for url in [ "https://static.acu.epita.fr/photos/%s", "https://static.acu.epita.fr/photos/%s/%%s" % self.gid, "https://intra-bocal.epitech.net/trombi/%s.jpg", "http://pub.23.tf/p/%s/%%s.jpg" % self.gid ]:
|
||||
for url in [ "https://static.acu.epita.fr/photos/%s", "https://static.acu.epita.fr/photos/%s/%%s" % self.gid, "https://intra-bocal.epitech.eu/trombi/%s.jpg", "http://whois.23.tf/p/%s/%%s.jpg" % self.gid ]:
|
||||
url = url % self.login
|
||||
_, status, _, _ = headers(url)
|
||||
if status == 200:
|
||||
return url
|
||||
try:
|
||||
_, status, _, _ = headers(url)
|
||||
if status == 200:
|
||||
return url
|
||||
except:
|
||||
logger.exception("On URL %s", url)
|
||||
return None
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue