danielpronych / python-twitter

Automatically exported from code.google.com/p/python-twitter
Apache License 2.0
0 stars 0 forks source link

twitter.TwitterError: Read-only application cannot POST #172

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Maybe twitter is using a distributed db that is out of sync, but it has been 5 
min... 

>>> api = twitter.Api(consumer_key=t['consumer_key'], 
consumer_secret=t['consumer_secret'],access_token_key=t['access_key'], 
access_token_secret=t['access_secret'] )

>>> print api.VerifyCredentials()
{"id": 203869946, "name": "test", "profile_background_color": "C0DEED", 
"profile_background_tile": false, "profile_image_url": 
"http://s.twimg.com/a/1287010001/images/default_profile_0_normal.png", 
"profile_link_color": "0084B4", "profile_sidebar_fill_color": 
"http://s.twimg.com/a/1287010001/images/themes/theme1/bg.png", 
"profile_text_color": "333333", "protected": false, "screen_name": 
"veyepar_test"}

>>> status = api.PostUpdate('I love python-twitter!')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/carl/temp/bar/lib/python2.6/site-packages/python_twitter-0.9_devel-py2.6.egg/twitter.py", line 2458, in PostUpdate
    self._CheckForTwitterError(data)
  File "/home/carl/temp/bar/lib/python2.6/site-packages/python_twitter-0.9_devel-py2.6.egg/twitter.py", line 3393, in _CheckForTwitterError
    raise TwitterError(data['error'])
twitter.TwitterError: Read-only application cannot POST

http://dev.twitter.com/apps/451502 shows: 

Access Level: read and write

But I did just change it from RO 10 min ago.  I will try again in a day, that 
should be plenty of time.

Original issue reported on code.google.com by cfkars...@gmail.com on 17 Oct 2010 at 9:14

GoogleCodeExporter commented 8 years ago
Twitter has always had issues with updates in it's distributed system. My hunch 
would be will be closing this in a couple days :)

Original comment by bear42 on 17 Oct 2010 at 11:19

GoogleCodeExporter commented 8 years ago
5 days, no change.

Test the twitter.Api PostUpdate method ... ok

That didn't actually tweet, right? 

Looking at the code:

class ApiTest(unittest.TestCase):
  def setUp(self):
    self._urllib = MockUrllib()
    api = twitter.Api(consumer_key='CONSUMER_KEY',
                      consumer_secret='CONSUMER_SECRET',
                      access_token_key='OAUTH_TOKEN',
                      access_token_secret='OAUTH_SECRET',
                      cache=None)

Original comment by cfkars...@gmail.com on 23 Oct 2010 at 7:24

GoogleCodeExporter commented 8 years ago
whack. now it works.
it = I just setup a 2nd app, made it RW as part of the setup (first one I set 
as RO, then changed to RW later.)

Original comment by cfkars...@gmail.com on 23 Oct 2010 at 7:53

GoogleCodeExporter commented 8 years ago
Had the same problem, waited awhile and despite the app page showing Read + 
Write, never could post.

On a hunch, recreated my access token, and voila -- worked first time, 
instantly. I expect the new tokens invalidated a cache and or the old ones 
never update, and it's just undocumented that you must generate new tokens with 
new permissions attached to them...?

Original comment by aaron.x...@gmail.com on 17 Feb 2012 at 12:28