Example #1
0
 def GetProfile(self, name):
     self._log("INFO", "EDJ.GetProfile", "params: {name}")
     parts = name.split()
     tag = "+".join(parts)
     url = self._url.replace("{TAG}", tag)
     response = self._send_request("GET", url, None, self._headers)
     content = response.content
     soup = BeautifulSoup(content, features="html5lib")
     elements = soup.findAll("a", {"class": "grid-item"})
     people = {}
     for i, element in enumerate(elements):
         if not element.has_attr('title'):
             continue
         fullname = element.get('title')
         firstname = fullname.split()[0].capitalize()
         lastname = fullname.split()[1].capitalize()
         string = element.get("class")[1]
         m = re.search("\d{4}", string)
         date = string[m.start():m.end()]
         school = "EDJ"
         people[i] = Person(firstname, lastname, school, date)
         people[i].SchoolFullName = "Ecole Du Journalisme"
         people[i].SchoolContact = "*****@*****.**"
         people[i].SchoolWebsite = "www.ecoledujournalisme.com"
         people[i].SchoolPhone = "04.97.08.28.28"
         people[i].SchoolAddress = "69 rue de Roquebillière, 06300 Nice"
         people[i].Enriched = True
     self._log("INFO", "Engineering.GetProfile", "exiting method")
     return people