mostm / pyqiwi

Python QIWI API Wrapper
http://pyqiwi.readthedocs.io/
MIT License
45 stars 25 forks source link

'NoneType' object has no attribute 'replace' #2

Closed sigaev-pro closed 6 years ago

sigaev-pro commented 6 years ago

Добрый день,

При попытке вызова wallet.profile возникает такая вот ошибка. Все остальные методы работают корректно.

Traceback (most recent call last):
  File "./manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/home/vadim/.local/share/virtualenvs/qiwi-gate-wK52063Z/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/home/vadim/.local/share/virtualenvs/qiwi-gate-wK52063Z/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/vadim/.local/share/virtualenvs/qiwi-gate-wK52063Z/lib/python3.6/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/vadim/.local/share/virtualenvs/qiwi-gate-wK52063Z/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute
    output = self.handle(*args, **options)
  File "/home/vadim/projects/qiwi-gate/qiwi/management/commands/qt.py", line 14, in handle
    pprint(wallet.profile)
  File "/home/vadim/.local/share/virtualenvs/qiwi-gate-wK52063Z/lib/python3.6/site-packages/pyqiwi/__init__.py", line 109, in profile
    return types.Profile.de_json(result_json)
  File "/home/vadim/.local/share/virtualenvs/qiwi-gate-wK52063Z/lib/python3.6/site-packages/pyqiwi/types.py", line 151, in de_json
    auth_info = AuthInfo.de_json(obj['authInfo'])
  File "/home/vadim/.local/share/virtualenvs/qiwi-gate-wK52063Z/lib/python3.6/site-packages/pyqiwi/types.py", line 193, in de_json
    last_login_date = cls.decode_date(obj['lastLoginDate'])
  File "/home/vadim/.local/share/virtualenvs/qiwi-gate-wK52063Z/lib/python3.6/site-packages/pyqiwi/types.py", line 50, in decode_date
    return datetime.datetime.strptime(date_string.replace('+03:00', 'Z'), "%Y-%m-%dT%H:%M:%SZ")
AttributeError: 'NoneType' object has no attribute 'replace'
sigaev-pro commented 6 years ago

Проверил на двух старых, живых, нормально функционирующих кошельках, в обоих случаях идентичная проблема.

mostm commented 6 years ago

Пофиксил эту ошибку в релизе 2.0.7. Она возникала так как метод для декодирования дате вызывался всегда, даже если данных об дате нет. Заметно это судя по вашим данным, только на старых аккаунтах.