diff options
author | icoz <icoz.vt@gmail.com> | 2015-05-24 15:35:03 +0300 |
---|---|---|
committer | icoz <icoz.vt@gmail.com> | 2015-05-24 15:35:03 +0300 |
commit | 11df6b8fb2a41b419627bf4a89b01d82c1ac6b51 (patch) | |
tree | 91dc080010600b82cd6d84622cd1ea450fddf919 /habr | |
parent | 06ad5a60347b1abe879c5a73089f959857ed942d (diff) |
Fix issue #4
Добавлена корректная обработка даты регистрации readonly-пользователей.
Diffstat (limited to 'habr')
-rw-r--r-- | habr/user.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/habr/user.py b/habr/user.py index 9b0576e..c70d424 100644 --- a/habr/user.py +++ b/habr/user.py @@ -151,7 +151,10 @@ class TMUser(object): tmp = self._doc.xpath("//div[@class='user_profile']//dd/a[@class='city']") self._user_profile['city'] = tmp[0].text if len(tmp) else '' self._user_profile['people_tags'] = [i for i in map(lambda x: x.text, p_tags)] - self._user_profile['registration_date'] = date_of_registration[:date_of_registration.index('\n')].strip() + try: + self._user_profile['registration_date'] = date_of_registration[:date_of_registration.index('\n')].strip() + except ValueError: + self._user_profile['registration_date'] = date_of_registration self._user_profile['last_login_date'] = date_of_last_login[27:] if len(date_of_last_login) > 27 else '' tmp = self._doc.xpath("//div[@class='stats']/div[@id='followers_count']/a") |