Git Product home page Git Product logo

python-twitter's Introduction

danielpronych

GitHub User Page

python-twitter's People

Contributors

bear avatar colinhowe avatar dewitt avatar

Watchers

 avatar

python-twitter's Issues

_FileCache._GetUsername fails when controlling process not a tty

_FileCache._GetUsername falls back to os.getlogin when trying to determine the 
current username 
for setting up its cache file, but when the controlling process is not a tty 
this will raise an IOError. 
Since there are plenty of situations where Python will be launched from 
something that isn't a tty, 
this should either be removed or be wrapped in a try/except with a further 
fallback.

Original issue reported on code.google.com by [email protected] on 21 Jan 2008 at 2:22

Getting Friends of a Friend

Trying to follow http://twitter.com/pythoncoders/with_friends but don't see
any possibility to fetch the time lines of all the friends ('with_friends')
of my friend 'pythoncoders'.

Your api doesn't provide an id parameter for GetFriendsTimeline - so i
can't do that. 

Or do i miss something ?

Original issue reported on code.google.com by [email protected] on 15 May 2007 at 11:54

Expose the in_reply_to_status_id and in_reply_to_user_id attributes for a status

I'm writing a small twitter mashup and needed access to the in_reply
attributes for a status.  I modified the twitter.py file to expose the
attributes.  Am submitting my code changes here as a patch file and with
the entire modified twitter.py as twitter.py.r118.01.

What changes did I implement?
I exposed two attributes for the status object that were not being exposed.
in_reply_to_status_id and in_reply_to_user_id
No additional methods or functions were created on these attributes.

What version of the product are you using? On what operating system?
r118 on Ubuntu 7.10

Usage:
api=twitter.Api()
timeline=api.GetPublicTimeline()
print timeline[0].in_reply_to_status_id

If the status is not a reply, then in_reply_to_status_id will be None .
If you retrieve a status based on the in_reply_to_status_id, and the status
is protected or private, an HTTPError 403 Forbidden will be returned. This
can be trapped via IOError like this:

try:
  tempstatus=api.GetStatus(timeline[0].in_reply_to_status_id)
except IOError, e:
  print 'IOError',e,'was returned'

Last Bit of Info:
I am a novice to Python (and programming) so please double check my code
and correct where appropriate. Clinton: Thanks so much for a great Api that
is so easy to work with, even for a novice like myself.

Original issue reported on code.google.com by [email protected] on 12 Jul 2008 at 11:41

Attachments:

python-twitter should catch 401 errors

What steps will reproduce the problem?
1. Call _FetchUrl with a good username and a bad password, and it fails out
with urllib2 raising a HTTPError.  python-twitter should probably catch that.

What is the expected output? What do you see instead?
I expect python-twitter to fial gracefully, and it kinda doesn't.

What version of the product are you using? On what operating system?
Version 0.5
Debian Lenny

Original issue reported on code.google.com by ay1244 on 20 Nov 2008 at 5:59

PostUpdate does not support unicode

What steps will reproduce the problem?
1. tweet = u'Tweet \u2019'
2. api.PostUpdate(twitter_username, twitter_password, tweet)
3. UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in
position 7: ordinal not in range(128)

What version of the product are you using? On what operating system?
SVN rev 47, Python 2.4.4, Linux 2.6.18

Please provide any additional information below.
Replacing the post_data line in PostUpdate with the following solves the
issue (for me at least)

post_data = urllib.urlencode({'status': text.encode('ascii',
'xmlcharrefreplace')})

Original issue reported on code.google.com by [email protected] on 12 May 2007 at 1:36

no way to use

What steps will reproduce the problem?
Try on a local instance of laconica

1. api = twitter.Api()
2. statuses = api.GetUserTimeline('testuser')

What is the expected output? What do you see instead?
Instead of messages list the follow error:

Trac detected an internal error: 
HTTPError: HTTP Error 404: Not Found

What version of the product are you using? On what operating system?
python-twitter 0.5 on windows xp

No support for any other instances of twitter as twitter.com

Original issue reported on code.google.com by [email protected] on 9 Mar 2009 at 12:43

  • Merged into: #53

twitter. fails on setup test

I did:
1. Build/Install/Test setuptools-0.6c9 (tests were fine.)
2. Build/Install/Test simplejson-2.0.9 (tests were fine.)
3. Build/Install/Test python-twitter-0.5 (2 failures)

I expected a long list of stuff saying methods and stuff that all said OK 
and then a small summary telling me it way A-OK. What I did see was a 
bunch of junk, with 2 failures. Here is my heavily edited output (I just 
cut out the OK lines):

"...
Test the twitter.Status AsJsonString method ... FAIL
...
Test the twitter.User AsJsonString method ... FAIL
...
======================================================================
FAIL: Test the twitter.Status AsJsonString method
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\users\administrator\desktop\python-twitter-0.5
\twitter_test.py", line
 121, in testAsJsonString
    self._GetSampleStatus().AsJsonString())
AssertionError: '{"created_at": "Fri Jan 26 23:17:14 +0000 2007", "id": 
4391023,
 "text": "A l\\u00e9gp\\u00e1rn\\u00e1s haj\\u00f3m tele van 
angoln\\u00e1kkal."
, "user": {"description": "Canvas. JC Penny. Three ninety-eight.", "id": 
718443,
 "location": "Okinawa, Japan", "name": "Kesuke 
Miyagi", "profile_image_url": "ht
tp:\\/\\/twitter.com\\/system\\/user\\/profile_image\\/718443
\\/normal\\/kesuke.
png", "screen_name": "kesuke", "url": "http:\\/
\\/twitter.com\\/kesuke"}}' != '{
"created_at": "Fri Jan 26 23:17:14 +0000 2007", "id": 4391023, "text": "A 
l\\u00
e9gp\\u00e1rn\\u00e1s haj\\u00f3m tele van angoln\\u00e1kkal.", "user": 
{"descri
ption": "Canvas. JC Penny. Three ninety-eight.", "id": 
718443, "location": "Okin
awa, Japan", "name": "Kesuke 
Miyagi", "profile_image_url": "http://twitter.com/s
ystem/user/profile_image/718443/normal/kesuke.png", "screen_name": "kesuke"
, "ur
l": "http://twitter.com/kesuke"}}'

======================================================================
FAIL: Test the twitter.User AsJsonString method
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\users\administrator\desktop\python-twitter-0.5
\twitter_test.py", line
 224, in testAsJsonString
    self._GetSampleUser().AsJsonString())
AssertionError: '{"description": "Indeterminate things", "id": 
673483, "location
": "San Francisco, CA", "name": "DeWitt", "profile_image_url": "http:\\/
\\/twitt
er.com\\/system\\/user\\/profile_image\\/673483
\\/normal\\/me.jpg", "screen_name
": "dewitt", "status": {"created_at": "Fri Jan 26 17:28:19 +0000 
2007", "id": 42
12713, "text": "\\"Select all\\" and archive your Gmail inbox.  The page 
loads s
o much faster!"}, "url": "http:\\/\\/unto.net\\/"}' !
= '{"description": "Indeter
minate things", "id": 673483, "location": "San Francisco, 
CA", "name": "DeWitt",
 "profile_image_url": "http://twitter.com/system/user/profile_image/673483/
norma
l/me.jpg", "screen_name": "dewitt", "status": {"created_at": "Fri Jan 26 
17:28:1
9 +0000 2007", "id": 4212713, "text": "\\"Select all\\" and archive your 
Gmail i
nbox.  The page loads so much faster!"}, "url": "http://unto.net/"}'

----------------------------------------------------------------------
Ran 36 tests in 1.311s

FAILED (failures=2)"


I am using version 0.5 of python-twitter, using python 2.6, on Windows 
Vista SP1

Just so that you know, I have never submitted a bug report of any kind to 
any project before, so I'm sorry if I've done this wrong or left out too 
much information.

Original issue reported on code.google.com by [email protected] on 6 Mar 2009 at 6:18

Sending a status update doesn't work.

What steps will reproduce the problem?
1. Try to send a status update. api.PostUpdate('text tet text')

What is the expected output? What do you see instead?
I would expect to see nothing, as the update would be posted successfully.
Instead, I got:

api.PostUpdate(data)
File "build/bdist.linux-i686/egg/twitter.py", line 1055, in PostUpdate
File "/usr/lib/python2.5/site-packages/PIL/__init__.py", line 313, in loads    
File "build/bdist.linux-i686/egg/simplejson/decoder.py", line 321, in decode
File "build/bdist.linux-i686/egg/simplejson/decoder.py", line 340, in
raw_decode
ValueError: No JSON object could be decoded

Could it be a problem with simplejson?

I have:
-Ubuntu 8.04 i386
-Python2.5
-simplejson 1.7.3 (distro package), and 1.9.2 (mamually installed
-python-twitter 0.5 and SVN
I tried all combinations of simplejson and python-twitter.

I also fail the install test. This would be a seperate issue, but I believe
they are related. Here is the output from python setup.py test:

running test
running egg_info
writing requirements to python_twitter.egg-info/requires.txt
writing python_twitter.egg-info/PKG-INFO
writing top-level names to python_twitter.egg-info/top_level.txt
writing dependency_links to python_twitter.egg-info/dependency_links.txt
reading manifest file 'python_twitter.egg-info/SOURCES.txt'
writing manifest file 'python_twitter.egg-info/SOURCES.txt'
running build_ext
Test the twitter._FileCache.Get method ... ok
Test the twitter._FileCache.GetCachedTime method ... ok
Test the twitter._FileCache constructor ... ok
Test the twitter._FileCache.Remove method ... ok
Test the twitter._FileCache.Set method ... ok
Test the twitter.Status AsDict method ... ok
Test the twitter.Status AsJsonString method ... FAIL
Test the twitter.Status __eq__ method ... ok
Test all of the twitter.Status getters and setters ... ok
Test the twitter.Status constructor ... ok
Test the twitter.Status NewFromJsonDict method ... ok
Test all of the twitter.Status properties ... ok
Test various permutations of Status relative_created_at ... ok
Test the twitter.User AsDict method ... ok
Test the twitter.User AsJsonString method ... FAIL
Test the twitter.User __eq__ method ... ok
Test all of the twitter.User getters and setters ... ok
Test the twitter.User constructor ... ok
Test the twitter.User NewFromJsonDict method ... ok
Test all of the twitter.User properties ... ok
Test the twitter.Api CreateFriendship method ... ok
Test the twitter.Api DestroyDirectMessage method ... ok
Test the twitter.Api DestroyFriendship method ... ok
Test the twitter.Api DestroyStatus method ... ok
Test the twitter.Api GetDirectMessages method ... ok
Test the twitter.Api GetFeatured method ... ok
Test the twitter.Api GetFollowers method ... ok
Test the twitter.Api GetFriends method ... ok
Test the twitter.Api GetFriendsTimeline method ... ok
Test the twitter.Api GetPublicTimeline method ... ok
Test the twitter.Api GetReplies method ... ok
Test the twitter.Api GetStatus method ... ok
Test the twitter.Api GetUser method ... ok
Test the twitter.Api GetUserTimeline method ... ok
Test the twitter.Api PostDirectMessage method ... ok
Test the twitter.Api PostUpdate method ... ok

======================================================================
FAIL: Test the twitter.Status AsJsonString method
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/daniel/projects/python-twitter-0.5/twitter_test.py", line
121, in testAsJsonString
    self._GetSampleStatus().AsJsonString())
AssertionError: '{"created_at": "Fri Jan 26 23:17:14 +0000 2007", "id":
4391023, "text": "A l\\u00e9gp\\u00e1rn\\u00e1s haj\\u00f3m tele van
angoln\\u00e1kkal.", "user": {"description": "Canvas. JC Penny. Three
ninety-eight.", "id": 718443, "location": "Okinawa, Japan", "name": "Kesuke
Miyagi", "profile_image_url":
"http:\\/\\/twitter.com\\/system\\/user\\/profile_image\\/718443\\/normal\\/kesu
ke.png",
"screen_name": "kesuke", "url": "http:\\/\\/twitter.com\\/kesuke"}}' !=
'{"created_at": "Fri Jan 26 23:17:14 +0000 2007", "id": 4391023, "text": "A
l\\u00e9gp\\u00e1rn\\u00e1s haj\\u00f3m tele van angoln\\u00e1kkal.",
"user": {"description": "Canvas. JC Penny. Three ninety-eight.", "id":
718443, "location": "Okinawa, Japan", "name": "Kesuke Miyagi",
"profile_image_url":
"http://twitter.com/system/user/profile_image/718443/normal/kesuke.png",
"screen_name": "kesuke", "url": "http://twitter.com/kesuke"}}'

======================================================================
FAIL: Test the twitter.User AsJsonString method
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/daniel/projects/python-twitter-0.5/twitter_test.py", line
224, in testAsJsonString
    self._GetSampleUser().AsJsonString())
AssertionError: '{"description": "Indeterminate things", "id": 673483,
"location": "San Francisco, CA", "name": "DeWitt", "profile_image_url":
"http:\\/\\/twitter.com\\/system\\/user\\/profile_image\\/673483\\/normal\\/me.j
pg",
"screen_name": "dewitt", "status": {"created_at": "Fri Jan 26 17:28:19
+0000 2007", "id": 4212713, "text": "\\"Select all\\" and archive your
Gmail inbox.  The page loads so much faster!"}, "url":
"http:\\/\\/unto.net\\/"}' != '{"description": "Indeterminate things",
"id": 673483, "location": "San Francisco, CA", "name": "DeWitt",
"profile_image_url":
"http://twitter.com/system/user/profile_image/673483/normal/me.jpg",
"screen_name": "dewitt", "status": {"created_at": "Fri Jan 26 17:28:19
+0000 2007", "id": 4212713, "text": "\\"Select all\\" and archive your
Gmail inbox.  The page loads so much faster!"}, "url": "http://unto.net/"}'

----------------------------------------------------------------------
Ran 36 tests in 0.309s

FAILED (failures=2)

Thanks,
Daniel

Original issue reported on code.google.com by [email protected] on 18 Jul 2008 at 4:51

Proxy authentication setting

What steps will reproduce the problem?
1. Get behind a proxy server that needs authentication
2. Try to get any data from twitter.com 

What is the expected output? What do you see instead?
Timeline or statuses or whatever we request

What version of the product are you using? On what operating system?
python-twitter 0.5, Python 2.5.2, Ubuntu 8.04

Please provide any additional information below.

I tried setting the proxy information on twitter.urllib2, but that doesn't
seem to work. How can I set my proxy settings to the library? Thanks for
the help

Original issue reported on code.google.com by [email protected] on 26 Oct 2008 at 12:56

md5 module is deprecated, hashlib is used instead

With Python 2.6, md5 and sha are deprecated and hashlib is being used
instead. Therefore I've written a small patch that simply uses hashlib.md5
instead of md5 itself..

You can see the error message when running the unit tests or simply doing
anything with the library..

Original issue reported on code.google.com by [email protected] on 30 Nov 2008 at 6:31

Attachments:

Change module name from twitter to something else.

This is just a suggestion, the module itself is working great. I had to
rename the django app I was working on from 'twitter' to something else to
avoid import conflicts with python-twitter. I would suggest you change the
name of this module to something less generic.

Some examples from similar projects:

The python wrapper for flickr's api (http://flickrapi.sourceforge.net) is
called flickrapi.

Delicious python wrapper
(http://www.michael-noll.com/wiki/Del.icio.us_Python_API) is deliciousapi

Original issue reported on code.google.com by [email protected] on 29 Jun 2008 at 9:44

Status relative time not working correctly (daylight saving issue)

Here in France, a new status is reported to have been created one hour late.

As I get a server error when I try to attach a file, here is a quick patch
against 0.5 to correct this :

Index: twitter.py
===================================================================
@@ -92,7 +92,8 @@
     Returns:
       The time this status message was posted, in seconds since the epoch.
     '''
-    return time.mktime(time.strptime(self.created_at, '%a %b %d %H:%M:%S
+0000 %Y'))
+    #added +' GMT' to avaoid daylight saving errors
+    return time.mktime(time.strptime(self.created_at+' GMT', '%a %b %d
%H:%M:%S +0000 %Y'))

   created_at_in_seconds = property(GetCreatedAtInSeconds,
                                    doc="The time this status message was "

Original issue reported on code.google.com by pierrejean.coudert on 14 Sep 2007 at 5:18

Get followers for any user

It would be great if Api.GetFollowers(self) took an optional param to
specify a user other than the currently authenticated user. 

python-twitter supports this behavior for retrieving friends with
GetFriends(self,user=None).

Twitter API docs suggest the appropriate URL format, e.g.
http://twitter.com/statuses/followers/bob.xml

see also http://apiwiki.twitter.com/REST+API+Documentation#followers


Original issue reported on code.google.com by [email protected] on 7 Mar 2009 at 9:08

Patch: twisted support

I've got a brief patch here that adds Twisted support to python-twitter.

I'd like to get it rolled in to the main distribution if that's possible. 
Let me know if there is anything that needs changing.

Original issue reported on code.google.com by Glyph.Lefkowitz on 1 Nov 2007 at 9:30

Attachments:

FAIL: Test the twitter.Status AsJsonString method

What steps will reproduce the problem?
1. Installed simplejson
2. Installed python twitter
3. Ran test script




23:57:02 python-twitter-0.5  : python twitter_test.py 
......................F.......F.....
======================================================================
FAIL: Test the twitter.Status AsJsonString method
----------------------------------------------------------------------
Traceback (most recent call last):
  File "twitter_test.py", line 121, in testAsJsonString
    self._GetSampleStatus().AsJsonString())
AssertionError: '{"created_at": "Fri Jan 26 23:17:14 +0000 2007", "id":
4391023, "text": "A l\\u00e9gp\\u00e1rn\\u00e1s haj\\u00f3m tele van
angoln\\u00e1kkal.", "user": {"description": "Canvas. JC Penny. Three
ninety-eight.", "id": 718443, "location": "Okinawa, Japan", "name": "Kesuke
Miyagi", "profile_image_url":
"http:\\/\\/twitter.com\\/system\\/user\\/profile_image\\/718443\\/normal\\/kesu
ke.png",
"screen_name": "kesuke", "url": "http:\\/\\/twitter.com\\/kesuke"}}' !=
'{"created_at": "Fri Jan 26 23:17:14 +0000 2007", "id": 4391023, "text": "A
l\\u00e9gp\\u00e1rn\\u00e1s haj\\u00f3m tele van angoln\\u00e1kkal.",
"user": {"description": "Canvas. JC Penny. Three ninety-eight.", "id":
718443, "location": "Okinawa, Japan", "name": "Kesuke Miyagi",
"profile_image_url":
"http://twitter.com/system/user/profile_image/718443/normal/kesuke.png",
"screen_name": "kesuke", "url": "http://twitter.com/kesuke"}}'

======================================================================
FAIL: Test the twitter.User AsJsonString method
----------------------------------------------------------------------
Traceback (most recent call last):
  File "twitter_test.py", line 224, in testAsJsonString
    self._GetSampleUser().AsJsonString())
AssertionError: '{"description": "Indeterminate things", "id": 673483,
"location": "San Francisco, CA", "name": "DeWitt", "profile_image_url":
"http:\\/\\/twitter.com\\/system\\/user\\/profile_image\\/673483\\/normal\\/me.j
pg",
"screen_name": "dewitt", "status": {"created_at": "Fri Jan 26 17:28:19
+0000 2007", "id": 4212713, "text": "\\"Select all\\" and archive your
Gmail inbox.  The page loads so much faster!"}, "url":
"http:\\/\\/unto.net\\/"}' != '{"description": "Indeterminate things",
"id": 673483, "location": "San Francisco, CA", "name": "DeWitt",
"profile_image_url":
"http://twitter.com/system/user/profile_image/673483/normal/me.jpg",
"screen_name": "dewitt", "status": {"created_at": "Fri Jan 26 17:28:19
+0000 2007", "id": 4212713, "text": "\\"Select all\\" and archive your
Gmail inbox.  The page loads so much faster!"}, "url": "http://unto.net/"}'

----------------------------------------------------------------------
Ran 36 tests in 0.128s

FAILED (failures=2)



Original issue reported on code.google.com by [email protected] on 9 Sep 2008 at 3:57

Adding source attribute to Status

Hey just thought that adding a source attribute for Status would be a cool 
thing to do.

Eg:  from Twitteriffic
        from web

Attached is the patch. Just the matter of adding a creator and setter methods. 
Hope it may be 
useful for someone.

Original issue reported on code.google.com by [email protected] on 21 Nov 2008 at 10:34

Attachments:

No spec file for RPM based systems

Spec attached to this ticket. Tested on Fedora 8.

There were two notes that popped out of the build ...

1. README is set with executable bit ... spec turns it off but probably
should be off in the source tarball as well.
2. twitter.py isn't an executable scripts (no executable bit), though it
has #!/usr/bin/python.


Original issue reported on code.google.com by [email protected] on 22 Mar 2008 at 6:10

Attachments:

Feature-Request: TinyURL replacement

What steps will reproduce the problem?
1. Call on the TinyURL API to replace the long URL of the string to a 
tinyurl.
2. twitter.api(user, password, argv.sys[1]) 
3. ' check my site at http://www.google.com/?translate....' -> ' check my 
site at http://tinyurl.com/asDsKJ1'

Looking around I found that is rather simple since TinyURL has an API on 
itself.
http://www.scripting.com/stories/2007/06/27/tinyurlHasAnApi.html

Only thing needed would be a return function that replace the long url 
with it's tinyurl.

Original issue reported on code.google.com by [email protected] on 6 Jul 2008 at 6:04

Constant number of public timeline statuses?

It appears that GetPublicTimeline() always retrieves 20 statuses. At least, 
after playing with it for a 
bit, I have not been able to get the number to vary. Is there a reason for 
this, and can it be 
changed? It would be nice to, say, return the updates for the last x minutes, 
for example.

Thanks,
Chris

Original issue reported on code.google.com by [email protected] on 10 Mar 2009 at 3:10

setup.py test - fails on AsJsonString methods

What steps will reproduce the problem?
1. Install latest simplejson
   - setup.py build SUCCEEDS
   - setup.py install SUCCEEDS
   - setup.py test SUCCEEDS

2. Install latest python-twitter 
   - setup.py build SUCCEEDS
   - setup.py install SUCCEEDS
   - setup.py test FAILS (2)
      - FAIL: Test the twitter.User AsJsonString method
      - FAIL: Test the twitter.Status AsJsonString method

3. Try to use python-twitter. Example source code:
   import twitter
   api = twitter.Api()

What is the expected output? What do you see instead?
I'm aware that the above program would produce nothing, but I still get an
error from this:

Traceback (most recent call last):
  File "twitter.py", line 1, in <module>
    import twitter
  File "/home/sam/Documents/Programming/Python/twitter.py", line 2, in <module>
    api = twitter.Api()

What version of the product are you using? On what operating system?
simplejson 2.0.6
python-twitter 0.5
Ubuntu 8.0.4

Please provide any additional information below.
N/A

Original issue reported on code.google.com by sam.starling on 28 Dec 2008 at 11:59

Extended version of lib

Hey i'm working on new version of this lib, coz it's little old.
I added few things, like SSL support, which is made by re. I know, maybe
it's not the best way, but for example if you want get data from search
api, it doesn't support ssl.

i also added all new properties from api, included few which are not
documented for now, like in status 
    status.truncated
    status.favorited
    status.in_reply_to_user_id
    status.source
    status.in_reply_to_status_id

i didn't finish search api, coz output is little different and i hope
someone will finish it sooner than me.

if you'll find something, just let me know.

i didn't decribe sections for now, don't have much time for it

Original issue reported on code.google.com by [email protected] on 7 Jan 2009 at 8:54

Attachments:

Feature Request: HTTPS by default

Just a suggestion, maybe the library should use HTTPS by default, a quick
search and replace of 'http://' with 'https://' in twitter.py works fine.

Either that or something like a 'ssl=True' kwarg in the Api() constructor?

Original issue reported on code.google.com by [email protected] on 30 Dec 2008 at 11:27

Attachments:

add VerifyCredential function

Account Methods
verify_credentials

Returns an HTTP 200 OK response code and a format-specific response if
authentication was successful.  Use this method to test if supplied user
credentials are valid with minimal overhead.



URL: http://twitter.com/account/verify_credentials.format

Formats: text (returned when no format is specified), xml, json

Method(s): GET


Original issue reported on code.google.com by [email protected] on 15 Aug 2008 at 12:02

Patch: allow count in GetFriendsTimeline()

The Twitter API supports an optional 'count' parameter, which "Specifies the 
number of statuses to 
retrieve. May not be greater than 200.":

http://apiwiki.twitter.com/REST+API+Documentation#friendstimeline

This patch adds the same parameter to python-twitter.

Original issue reported on code.google.com by [email protected] on 3 Mar 2009 at 9:45

Attachments:

GetReplies doesn't account for errors

Twitter's database is currently down for maintenance, meaning that all
requests are returning errors.

The traceback is as follows:
Traceback:
File "../ext\django\core\handlers\base.py" in get_response
  86.                 response = callback(request, *callback_args,
**callback_kwargs)
File "summit\mashup\views.py" in content
  13.     latest_messages = message().getMessages()
File "summit\mashup\models.py" in getMessages
  56.         replies = api.GetReplies()
File "../ext\twitter.py" in GetReplies
  1099.     return [Status.NewFromJsonDict(x) for x in data]
File "../ext\twitter.py" in NewFromJsonDict
  307.     return Status(created_at=data.get('created_at', None),

Exception Type: AttributeError at /en/live/
Exception Value: 'unicode' object has no attribute 'get'

The locals on line 1099, in GetReplies are:
data    {u'error': u'Twitter is down for database maintenance. It will
return in about an hour.'}
json    '{"error":"Twitter is down for database maintenance. It will return
in about an hour."}\n'

The locals on line 307, in NewFromJsonDict are:
data    u'error'
user    None

In cases such as this, a TwitterException should be raised with the
contents of this error message

Original issue reported on code.google.com by tarkatronic on 18 Nov 2008 at 5:31

test suite fails on twitter.Status getters and setters and twitter.Status properties

When I run the test:

(shouldn't real comparison rather be "X within tolerance interval"?)

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

[artm@salyangoz python-twitter-0.4]$ python twitter_test.py
/var/lib/python-support/python2.5/simplejson/scanner.py:6:
DeprecationWarning: The sre module is deprecated, please import re.
  from sre import VERBOSE, MULTILINE, DOTALL
........................F..F........
======================================================================
FAIL: Test all of the twitter.Status getters and setters
----------------------------------------------------------------------
Traceback (most recent call last):
  File "twitter_test.py", line 53, in testGettersAndSetters
    self.assertEqual(1169882234, status.GetCreatedAtInSeconds())
AssertionError: 1169882234 != 1169849834.0

======================================================================
FAIL: Test all of the twitter.Status properties
----------------------------------------------------------------------
Traceback (most recent call last):
  File "twitter_test.py", line 69, in testProperties
    self.assertEqual(1169882234, status.created_at_in_seconds)
AssertionError: 1169882234 != 1169849834.0

----------------------------------------------------------------------
Ran 36 tests in 0.157s

FAILED (failures=2)

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Original issue reported on code.google.com by [email protected] on 11 Sep 2007 at 8:43

Status incorrectly calculates relative_created_at

From an external bug report:

  import twitter
  api = twitter.Api()
  status = api.GetUserTimeline( ... , count=1)
  print [s.relative_created_at for s in status]

  that outputs ['about 12 hours ago'] (note: my last message according to
twitter was 19 hours ago) and the created_at_in_seconds always gives
[1175165417.0]. The relative one seems to change depending one whos
username I use, but it is never right. 

Original issue reported on code.google.com by dclinton on 2 Apr 2007 at 3:29

Support all available parameters for status methods (with fix)

After reading issue 22
(http://code.google.com/p/python-twitter/issues/detail?id=22), I noticed
that several twitter api parameters aren't supported with this module (not
just since_id).  I'm not sure, but I suspect that is because those
parameters were added to the twitter API after this module was written.

I've uploaded a patch that with fix issue 22 with forward computability for
future twitter api parameters.  The patch allows pethods in this module
accept parameters as a dictionary, instead of individually.  For example:

timeline = twitter.Api().GetUserTimeline(user = sodio,
parameters={'since_id': '932442808'})

instead of:

timeline = twitter.Api().GetUserTimeline(user = sodio, since_id = 932442808)

This will support all existing parameters while maintaining forward
compatibility with future parameters that are supported by the twitter API
.

The patch also maintains backwards compatibility with pre-existing
installations.  All tests pass (expect for the 2 that we already know
about).  Someone might want to create new tests that make use of the
parameters dictionary.

Modified methods:
- GetPublicTimeline
- GetFriendsTimeline
- GetUserTimeline

Original issue reported on code.google.com by sam%[email protected] on 27 Sep 2008 at 7:51

Attachments:

get rid of all those java-ish getters and setters

Hi,

Are there any plans to get rid of all the java-style getters and setters?

Code like the stuff below can be cut down to 1 line by replacing these
accessors by a normal variable, and does not reduce any of the
functionality, but does increase the legibility of the code.
Note that if a checking setter or special getter is needed, one can always
put that in later.

I'm offering to assist on resolving this issue if needed.

quoting twitter.py lines 107..124:
  def GetCreatedAt(self):
    '''Get the time this status message was posted.

    Returns:
      The time this status message was posted
    '''
    return self._created_at

  def SetCreatedAt(self, created_at):
    '''Set the time this status message was posted.

    Args:
      created_at: The time this status message was created
    '''
    self._created_at = created_at

  created_at = property(GetCreatedAt, SetCreatedAt,
                        doc='The time this status message was posted.')


Original issue reported on code.google.com by [email protected] on 2 Mar 2009 at 5:27

Patch: grammar fix for relative_created_at property

This patch fixes the output of the 'relative_created_at' property on status
updates between one and two hours old, e.g.

>>> now = int(time.time())
>>> ft = api.GetFriendsTimeline(user, count=30)
>>> for f in ft: print f.relative_created_at, now - f.created_at_in_seconds
... 
about 15 minutes ago 920
about 23 minutes ago 1397
about 44 minutes ago 2682
about an hour ago 2895
about an hour ago 3951
about an hour ago 4419
about 1 hours ago 4606
about 1 hours ago 5138
about 1 hours ago 7046
about 2 hours ago 7479
about 2 hours ago 7764

Original issue reported on code.google.com by [email protected] on 3 Mar 2009 at 4:58

Attachments:

"instancemethod is not iterable

What steps will reproduce the problem?
1. Everything built/installed (Python-twitter-0.5, simplejson 2.0.4 and python 
2.5 on a Mac OSX 
Leopard System)
2. Looked for the public time line just as in the instructions (see: 
http://static.unto.net/python-
twitter/0.5/doc/twitter.html):
>>> import twitter
>>> api=twitter.Api()
>>> statuses=api.GetPublicTimeline
>>> print [s.user.name for s in statuses]



What is the expected output? What do you see instead?
Expected: sth like:
    [u'DeWitt', u'Kesuke Miyagi', u'ev', u'Buzz Andersen', u'Biz Stone'] #...
Seen:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'instancemethod' object is not iterable

Original issue reported on code.google.com by [email protected] on 26 Oct 2008 at 8:46

Retrieve rate_limit_status for authenticated user (patch)

I'm working on a desktop application for Twitter, and I wanted to be able
to get information about a user's rate_limit (see
http://apiwiki.twitter.com/REST-API-Documentation?SearchFor=rate+limit&sp=1#Rate
Limiting
and
http://apiwiki.twitter.com/REST-API-Documentation?SearchFor=rate+limit&sp=1#rate
limitstatus).

The following patch seems to offer the functionality that I need.  I
created two methods in the Api class: GetRateLimitStatus and
MaximumHitFrequency.  The former retrieves the dictionary from Twitter and
the latter offers the number of seconds that can be used as a regular
interval for checking Twitter without exceeding the user's rate_limit.

There's a good chance that I will have further modifications pertaining to
the rate_limit business, but I wanted to contribute this back as soon as I
could.

Original issue reported on code.google.com by [email protected] on 10 Mar 2009 at 8:17

Attachments:

Non ASCII characters causes exception

What steps will reproduce the problem?
1. send an update string containing any non ascii character ( like ñ )
2. sample :
>>> text = "words with ñ"
>>> import twitter
>>> api=twitter.Api('c######','######')
>>> api.PostUpdate(text)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.macosx-10.5-i386/egg/twitter.py", line 1054, in PostUpdate
  File "build/bdist.macosx-10.5-i386/egg/twitter.py", line 1418, in _FetchUrl
  File "build/bdist.macosx-10.5-i386/egg/twitter.py", line 1391, in _EncodePostData
  File "build/bdist.macosx-10.5-i386/egg/twitter.py", line 1356, in _Encode
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal 
not in range(128)


probando con la ñ
Traceback (most recent call last):
  File "twitminal.py", line 79, in <module>
    api.PostUpdate(text)
  File "build/bdist.macosx-10.5-i386/egg/twitter.py", line 1054, in PostUpdate
  File "build/bdist.macosx-10.5-i386/egg/twitter.py", line 1418, in _FetchUrl
  File "build/bdist.macosx-10.5-i386/egg/twitter.py", line 1391, in _EncodePostData
  File "build/bdist.macosx-10.5-i386/egg/twitter.py", line 1356, in _Encode
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 16: 
ordinal not in 
range(128)


What is the expected output? What do you see instead?
This shouldnt be a problem to encode.

What version of the product are you using? On what operating system?
latest stable version, on Leopard.


Original issue reported on code.google.com by [email protected] on 20 Feb 2009 at 7:24

Improved date parsing (locale problems + the fix) follow up to issue 10

in reference to: http://code.google.com/p/python-twitter/issues/detail?id=10

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 issue reported on code.google.com by [email protected] on 14 Aug 2008 at 11:09

Proxy support missing

Actual implementation doesn't allow to explicitly specify a proxy (you can
override _GetOpener() so you can chain a ProxyHandler over the
HTTPBasicAuthHandler, but that's a kinda hack).

It's a common need to pass through a proxy, so there should be a (easy) way
to specify proxy informations.

Original issue reported on code.google.com by [email protected] on 30 Sep 2008 at 5:37

OSError thrown from _GetUsername when accessed from non tty terminal

What steps will reproduce the problem?
1. Utilise python-twitter from a non tty terminal (e.g. from Asterisk in
this case)
2.
3.

What is the expected output? What do you see instead?
  File "/usr/lib/python2.5/site-packages/twitter.py", line 1477, in __init__
    self._InitializeRootDirectory(root_directory)
  File "/usr/lib/python2.5/site-packages/twitter.py", line 1537, in
_InitializeRootDirectory
    root_directory = self._GetTmpCachePath()
  File "/usr/lib/python2.5/site-packages/twitter.py", line 1531, in
_GetTmpCachePath
    username = self._GetUsername()
  File "/usr/lib/python2.5/site-packages/twitter.py", line 1525, in
_GetUsername
    os.getlogin() or \
OSError: [Errno 25] Inappropriate ioctl for device
Twitter Failed

What version of the product are you using? On what operating system?
python-twitter Revision 116
Python 2.5.1 (r251:54863, Mar  7 2008, 03:39:23) 
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2


Please provide any additional information below.

 I have been able to work around this issue by catching the OSError
exception. Patch attached. 

Original issue reported on code.google.com by [email protected] on 20 May 2008 at 12:37

Attachments:

Only return 100 users

It would be nice to be able to return all your twitter users rather than
the first 100.

There are options in the twitter api
(http://groups.google.com/group/twitter-development-talk/web/api-documentation#U
serMethods)
to return the next 100 friends.  Not sure how this is used though.

I'll try and take a look, but I'm new to python.

Original issue reported on code.google.com by [email protected] on 11 Jul 2008 at 6:52

enable since_id in timeline functions

The since_id field is a much handier way of retrieving new updates than the 
since field, since it 
doesnt require fiddling around with randomly formatted date fields quite as 
much.  This patch 
enables them in Api.GetFriendsTimeline and GetUserTimeline

Original issue reported on code.google.com by [email protected] on 15 Jul 2008 at 12:07

Attachments:

Patch : add a SetSource method to change the "from web" to "from source" status field on Twitter web site

You need first to send an email to Alex Payne(twitter) in order for him to
enable this feature for your application.

I'm using this with my Pwytter client.

I always get a server error when I try to attach a file, so here is the
patch gain (against 0.5) :


Index: twitter.py
===================================================================
@@ -902,6 +902,7 @@
     self._cache_timeout = Api.DEFAULT_CACHE_TIMEOUT
     self._InitializeRequestHeaders(request_headers)
     self._InitializeUserAgent()
+    self._InitializeJSONParameters()
     self._input_encoding = input_encoding
     self.SetCredentials(username, password)

@@ -1051,6 +1052,7 @@
       raise TwitterError("Text must be less than or equal to 140 characters.")
     url = 'http://twitter.com/statuses/update.json'
     data = {'status': text}
+    data.update(self._json_param)
     json = self._FetchUrl(url, post_data=data)
     data = simplejson.loads(json)
     return Status.NewFromJsonDict(data)
@@ -1292,6 +1294,17 @@
     self._request_headers['X-Twitter-Client'] = client
     self._request_headers['X-Twitter-Client-URL'] = url
     self._request_headers['X-Twitter-Client-Version'] = version
+    
+  def SetSource(self, source):
+    ''' Set the source parameters used to display the "from source" with 
+        each status on Twitter web site.
+        
+    Args:
+      source:
+        The source name as a string.  Will be sent to the server as
+         the 'source' JSON parameter.
+    '''
+    self._json_param['source'] = source

   def _BuildUrl(self, url, path_elements=None, extra_params=None):
     # Break url into consituent parts
@@ -1328,6 +1341,9 @@
                  (self._urllib.__version__, twitter.__version__)
     self.SetUserAgent(user_agent)

+  def _InitializeJSONParameters(self):
+    self._json_param = {}
+
   def _AddAuthorizationHeader(self, username, password):
     if username and password:
       basic_auth = base64.encodestring('%s:%s' % (username, password))[:-1]

Original issue reported on code.google.com by pierrejean.coudert on 14 Sep 2007 at 5:25

Multiple posts to bypass the 140 char limit per message

I made this patch so the user, instead of receiving an error
on posting a message over the limit of 140 chars, will be let to
post multiple and recursive messages to complete his post.

Example post:
--
# The start of this test. TODO SOLVED! (breaking long/big messages, but not
the words/links!) Posting from python-twitter->

# ...(http://code.google.com/p/py...) patched in my ipython
(http://ipython.scipy.org/moin/) shell. This is a message bigger than->

# ...140 chars, the limitation for individual messages here in Twitter.
This little patch I made a few minutes ago is for breaking this big->

# ...messages into little ones (140 chars each), putting these "..." and
"->" markers to signal that this post is to be "continued" in the->

# ...next post. The post order is reverse, so, the last part of the
splitted message is sent first to the Twitter, so to read it, aggregating->

# ... the separated parts, is easily done. Motivation? To post freely
without having to count bytes. The end of this test.
--

Patch attached. Made to fit into rev 126 (current for today).

Thank you for this awesome module.

Regards,
Rogério Schneider

Original issue reported on code.google.com by stockrt on 19 Feb 2009 at 3:02

Attachments:

Rename needs an unlink in front

At least on Windows you can not call os.rename with a target which already
exists. This will throw an WindowsException.

twitter.py +863

Original issue reported on code.google.com by [email protected] on 26 Apr 2007 at 1:56

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.