Comments (9)
Sorry, the last line should be
+ return time.mktime(time.strptime(self.created_at+' GMT', '%a %b %d %H:%M:%S
+0000 %Y %Z'))
Original comment by pierrejean.coudert
on 14 Sep 2007 at 6:16
from python-twitter.
Original comment by dclinton
on 15 Sep 2007 at 7:15
- Changed state: accepted
- Added labels: Priority-High
- Removed labels: Priority-Medium
from python-twitter.
the above fix is incorrect.
instead, simply replace 'time.mktime' with 'calendar.timegm' in the original
code.
Original comment by [email protected]
on 13 Mar 2008 at 1:32
from python-twitter.
you'll also need to do the same for the relevant tests
Original comment by [email protected]
on 13 Mar 2008 at 1:40
from python-twitter.
attached a patch that keeps all timestamps in UTC. This eliminates any need to
deal
with DST.
Original comment by [email protected]
on 13 Mar 2008 at 2:06
Attachments:
from python-twitter.
Looking at the patch right now. Thanks!
Original comment by dclinton
on 13 Mar 2008 at 2:10
from python-twitter.
Patch applied in SVN trunk. Please verify.
Original comment by dclinton
on 13 Mar 2008 at 3:17
- Changed state: Fixed
from python-twitter.
revision 103 matched exactly with my working copy.
Original comment by [email protected]
on 13 Mar 2008 at 3:53
from python-twitter.
Sorry for the confusion, but the current way to parse the date does not work
with
alternate locale settings.
calendar.timegm(time.strptime(self.created_at, '%a %b %d %H:%M:%S +0000 %Y'))
Since twitter appears to be using rfc822 dates, parse them as such:
import rfc822
calendar.timegm(rfc822.parsedate(self.created_at))
Example of the problem:
>>> import time
>>> mytime = time.strftime('%a %b %d %H:%M:%S +0000 %Y')
>>> time.strptime(mytime, '%a %b %d %H:%M:%S +0000 %Y')
(2008, 8, 8, 13, 22, 37, 4, 221, -1)
>>> import locale
>>> locale.setlocale(locale.LC_ALL, ('Russian_Russia', '1251'))
'Russian_Russia.1251'
>>> time.strptime(mytime, '%a %b %d %H:%M:%S +0000 %Y')
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "python\lib\_strptime.py", line 330, in strptime
(data_string, format))
ValueError: time data did not match format: data=Fri Aug 08 13:22:37 +0000
2008
fmt=%a %b %d %H:%M:%S +0000 %Y
>>> import rfc822
>>> rfc822.parsedate(mytime)
(2008, 8, 8, 13, 22, 37, 0, 1, 0)
Original comment by [email protected]
on 8 Aug 2008 at 5:31
from python-twitter.
Related Issues (20)
- Character Limit does not accurately match URL t.co wrapper
- NewFromJsonDict AttributeError HOT 2
- "UnicodeEncodeError: 'ascii' codec can't encode characters" during GetSearch() for utf-8 encoded search terms
- Current head (dca91beb7418) has a failing unit test HOT 1
- 404 - Dependency issue? HOT 1
- README.md did not get up to speed HOT 1
- Pip Install from source fails (google code) HOT 3
- api.GetMentions errors HOT 1
- import twitter produces AttributeError: 'module' object has no attribute 'Http' HOT 1
- Getting {“errors”:[{“message”:“Bad Authentication data”,“code”:215}]} using python-twitter API v1.0 HOT 5
- Direct Messages failing HOT 3
- GetPublicTimeline() is referenced in docs but not implemented HOT 1
- python 3.x HOT 2
- GetUser gives a "page does not exist 34" HOT 2
- remove dependency to python-oauth2 switch to oauthlib HOT 2
- GetUserTimeLine does not work
- status of python-twitter-1.1
- api.CreateList returns UnboundLocalError
- Cannot be installed with Pip HOT 2
- User behind a proxy will face a problem
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-twitter.