File tree Expand file tree Collapse file tree 3 files changed +7
-27
lines changed Expand file tree Collapse file tree 3 files changed +7
-27
lines changed Original file line number Diff line number Diff line change 2
2
"""This module provides the basic models used in github3.py."""
3
3
from __future__ import unicode_literals
4
4
5
- from datetime import datetime
6
5
from json import dumps , loads
7
6
from logging import getLogger
8
7
8
+ import dateutil .parser
9
9
import requests
10
10
from requests .compat import is_py2 , urlparse
11
11
12
12
from . import exceptions
13
13
from .session import GitHubSession
14
- from .utils import UTC
15
14
16
- __timeformat__ = '%Y-%m-%dT%H:%M:%SZ'
17
15
__logs__ = getLogger (__package__ )
18
16
19
17
@@ -145,9 +143,7 @@ def _strptime(cls, time_str):
145
143
:rtype: datetime or None
146
144
"""
147
145
if time_str :
148
- # Parse UTC string into naive datetime, then add timezone
149
- dt = datetime .strptime (time_str , __timeformat__ )
150
- return dt .replace (tzinfo = UTC ())
146
+ return dateutil .parser .parse (time_str )
151
147
return None
152
148
153
149
def __repr__ (self ):
Original file line number Diff line number Diff line change @@ -45,26 +45,6 @@ def timestamp_parameter(timestamp, allow_none=True):
45
45
raise ValueError ("Cannot accept type %s for timestamp" % type (timestamp ))
46
46
47
47
48
- class UTC (datetime .tzinfo ):
49
-
50
- """Yet another UTC reimplementation, to avoid a dependency on pytz or
51
- dateutil."""
52
-
53
- ZERO = datetime .timedelta (0 )
54
-
55
- def __repr__ (self ):
56
- return 'UTC()'
57
-
58
- def dst (self , dt ):
59
- return self .ZERO
60
-
61
- def tzname (self , dt ):
62
- return 'UTC'
63
-
64
- def utcoffset (self , dt ):
65
- return self .ZERO
66
-
67
-
68
48
def stream_response_to_file (response , path = None ):
69
49
"""Stream a response body to the specified file.
70
50
Original file line number Diff line number Diff line change 34
34
os .system ("python setup.py bdist_wheel sdist upload" )
35
35
sys .exit ()
36
36
37
- requires .extend (["requests >= 2.18" , "uritemplate >= 3.0.0" ])
37
+ requires .extend ([
38
+ "requests >= 2.18" ,
39
+ "uritemplate >= 3.0.0" ,
40
+ "python-dateutil >= 2.6.0" ,
41
+ ])
38
42
39
43
__version__ = ''
40
44
with open ('github3/__about__.py' , 'r' ) as fd :
You can’t perform that action at this time.
0 commit comments