Permalink
Browse files

refined location parsing. Now returning country code

  • Loading branch information...
1 parent cdb71e7 commit 5765553f1ba96f61ffd059b7fb037d607ae45bda philgo20 committed Jan 18, 2011
Showing with 10 additions and 0 deletions.
  1. +10 −0 liclient/parsers/mappers.py
@@ -224,6 +224,7 @@ def __init__(self, data, xml):
self.member_url_resources = []
if not self.profile_url:
self.set_profile_url()
+ self.get_location()
self.get_positions()
self.get_educations()
self.get_twitter_accounts()
@@ -233,6 +234,15 @@ def set_profile_url(self):
try:
profile_url_xpath = etree.XPath('site-standard-profile-request/url')
self.profile_url = profile_url_xpath(self.xml)[0].text.strip()
+ except:
+ pass
+
+ def get_location(self):
+ try:
+ location_name_xpath = etree.XPath('location/name')
+ self.location = location_name_xpath(self.xml)[0].text.strip()
+ country_code_xpath = etree.XPath('location/country/code')
+ self.country = country_code_xpath(self.xml)[0].text.strip()
except:
pass

0 comments on commit 5765553

Please sign in to comment.