danielpronych / python-twitter

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

Can't get tweet.py to work. #200

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I have installed python-twitter version 0.8.2. I only want this wrapper to send 
tweets, so I'm trying to use tweet.py example.
My OS is Angstrom Linux running in a Guruplug (ARM).
Python is 2.6.5.

I followed the installation steps and installed the required dependencies, but 
can't get tweet.py to work, each time I run it, I get the help screen and no 
tweet is sent.

First I tried exporting variables:
$ export TWEETUSERNAME=my_username
$ exprot TWEETPASSWORD=my_password
$ python tweet.py "HELLO WORLD"

But no luck, I get the help screen and no tweet is sent

Then I tried creating in my home directory the .tweetrc file with the contents:
[Tweet]
consumer_key: my_username
consumer_secret: my_password

And the result is the same, I only get the help screen and no tweet is sent.

Then I have read some oAuth info and I can't understand a word :(

Are access_key and access_secret necessary? What am I doing wrong?

Original issue reported on code.google.com by esakafor...@gmail.com on 25 Jun 2011 at 9:36

GoogleCodeExporter commented 8 years ago
I tried running tests and got a lot of errors in the twiiter.Api methods. 
Attached is the output of the tests.

Original comment by esakafor...@gmail.com on 25 Jun 2011 at 10:08

Attachments:

GoogleCodeExporter commented 8 years ago
Googled a bit more and found that the problem with the tests is because 
resource files are not included in the archive. Cloned the source repository 
and all test errors excepting one are gone:

======================================================================
ERROR: Test the twitter.Api GetFollowers method
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jalon/pytw/python-twitter/twitter_test.py", line 408, in testGetFollowers
    users = self._api.GetFollowers(page=1)
TypeError: GetFollowers() got an unexpected keyword argument 'page'

----------------------------------------------------------------------

My problem with tweet.py is still there. I get only the help page whatever I 
try.

Original comment by esakafor...@gmail.com on 25 Jun 2011 at 10:28

GoogleCodeExporter commented 8 years ago
I solved the problem. There is nothing wrong with your library, it's just I was 
too stupid to figure out the process required to register the application. I 
think it would be great to detail the process in the documentation, something 
like this:

To be able to use python-tweeter

1.- Register a new application in twitter to get consumer key and consumer 
secret. Be sure to chante the permissions given to the app as you wish. In 
Application Type enter check "Client". When you complete this step, you will be 
given consumer key and consumer secret numbers.

2.- Edit get_access_token.py and assign the consumer key and secret numbers:
consumer_key    = 'obtained_consumer_key'
consumer_secret = 'obtained_consumer_secret'

3.- Execute get_access_token.py script. It will request you to go to a webpage. 
Copy the URL, paste it in the browser and when the page appears, grant access 
to the application. You will be given a PIN code. Input the PIN code to the 
get_access_token.py script. The script will give you your access token key and 
secret.

4.- Now you have the four needed parameters to authenticate your application. 
Use your preferred method to pass them to tweet.py. For example edit .tweetrc 
in your home directory and add these five lines:
[Tweet]
consumer_key: your_consumer_key_obtained_in_step_1
consumer_secret: your_consumer_secret_obtained_in_step_1
access_key: your_access_key_obtained_in_step_3
access_secret: your_access_secret_obtained_in_step_3

Original comment by esakafor...@gmail.com on 25 Jun 2011 at 11:25

GoogleCodeExporter commented 8 years ago
Almost everyone gets that part wrong if they are not a regular twitter dev - 
coming from the original way of using command line twitter tools to this way is 
not obvious.

I'm glad you were able to figure it out.

Original comment by bear42 on 26 Jun 2011 at 8:57