import twitter
api = twitter.Api(consumer_key=' ',
consumer_secret=' ',
access_token_key=' ',
access_token_secret=' ')
friends=api.PostUpdate("First Tweet from PYTHON APP ")
I have done everything as said at http://abhi74k.wordpress.com/2010/12/21/tweeting-from-python/ but when I full inside it and press enter, nothing happens. Can you help me about that?
Ok it is because of that I couldn’t download python-twitter API correctly. It gives me this error when I try to follow those steps:
figen@figen-Satellite-A350:~/Downloads/python-twitter-0.8.2$ python setup.py install
running install
running build
running build_py
running install_lib
copying build/lib.linux-x86_64-2.7/twitter.py -> /usr/local/lib/python2.7/dist-packages
error: /usr/local/lib/python2.7/dist-packages/twitter.py: Permission denied
http://code.google.com/p/python-twitter/
Ok I installed setup.py but now it gives this error:
figen@figen-Satellite-A350:~/Downloads/python-twitter-0.8.2$ python twitter_test.py
Traceback (most recent call last):
File "twitter_test.py", line 29, in <module>
import twitter
File "/home/figen/Downloads/python-twitter-0.8.2/twitter.py", line 65, in <module>
import oauth2 as oauth
ImportError: No module named oauth2
Now it says twitter module doesn’t have the module. How to get it?
api = twitter.Api(consumer_key='removed',
consumer_secret='removed',
access_token_key='removed',
access_token_secret='removed')
friends=api.PostUpdate("If you see this,I managed to send my first tweet from Python Shell. Yay! =)")
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
api = twitter.Api(consumer_key='removed for security=)',
AttributeError: 'module' object has no attribute 'Api'
There are several things causing your problem.
1) The permission denied error (error: /usr/local/lib/python2.7/dist-packages/twitter.py: Permission denied) is because you do not have administrator privileges. Try
sudo python setup.py install2) You need to install the missing dependencies (i.e. oauth2) you can get oauth2 from here http://github.com/simplegeo/python-oauth2 make sure you have the other dependencies needed which are SimpleJson and HTTPLib2. You can find more details on this information on the python-twitter-api site.
Hope this solves it!