diff options
Diffstat (limited to 'pygithub3/services/base.py')
-rw-r--r-- | pygithub3/services/base.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/pygithub3/services/base.py b/pygithub3/services/base.py index 649b2b3..5fed1db 100644 --- a/pygithub3/services/base.py +++ b/pygithub3/services/base.py @@ -1,10 +1,13 @@ #!/usr/bin/env python # -*- encoding: utf-8 -*- +from datetime import datetime + from pygithub3.core.client import Client +from pygithub3.core.errors import NotFound from pygithub3.core.result import smart, normal from pygithub3.requests.base import Factory -from pygithub3.core.errors import NotFound +from pygithub3.resources.base import GITHUB_DATE_FORMAT class Service(object): @@ -41,6 +44,15 @@ class Service(object): self._client = Client(**config) self.request_builder = Factory() + def _normalize_date(self, key, _dict): + """ If ``key`` comes as ``datetime``, it'll normalize it """ + try: + key = str(key) + date = datetime.strftime(_dict.get(key), GITHUB_DATE_FORMAT) + _dict.update({key: date}) + except: + pass + @property def remaining_requests(self): return Client.remaining_requests |