From 889e3762540e143d39a9d9553d089f843359d0f0 Mon Sep 17 00:00:00 2001 From: nemunaire Date: Thu, 28 May 2015 07:18:07 +0200 Subject: [PATCH] [whois] Module try to find a recent photo --- modules/whois.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/whois.py b/modules/whois.py index 5d4638e..f59b541 100644 --- a/modules/whois.py +++ b/modules/whois.py @@ -10,6 +10,7 @@ from nemubot.tools.xmlparser.node import ModuleState nemubotversion = 3.4 from more import Response +from networking.page import headers PASSWD_FILE = None @@ -48,8 +49,12 @@ class Login: def get_photo(self): if self.login in context.data.getNode("pics").index: return context.data.getNode("pics").index[self.login]["url"] - else: - return "https://static.acu.epita.fr/photos/%s" % self.login + 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 ]: + url = url % self.login + _, status, _, _ = headers(url) + if status == 200: + return url + return None def found_login(login):