An error has occurred!Status code = 401

162 views
Skip to first unread message

Veck Hsiao

unread,
Sep 10, 2013, 8:44:48 AM9/10/13
to twe...@googlegroups.com
Hi,
I have a problem about using tweeql.
I install tweeql from github on Linux Mint.
I finished initially setting and typed tweeql-command-line.py to run the program
Then I try the example "SELECT text from twitter_sample;", the terminal shows the following error message:

"An error has occurred!Status code = 401"

How could it happen and how to solve it?

Thank,
  Veck

Adam Marcus

unread,
Sep 11, 2013, 11:18:25 AM9/11/13
to twe...@googlegroups.com
Veck,

Thanks for trying TweeQL!  According to:

https://dev.twitter.com/docs/error-codes-responses

error 401 suggests your authentication credentials are missing or incorrect.  Did you add a username/password to settings.py?

-Adam


--
You received this message because you are subscribed to the Google Groups "TweeQL" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tweeql+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Veck Hsiao

unread,
Sep 11, 2013, 11:29:02 AM9/11/13
to twe...@googlegroups.com, mar...@marcua.net
Thanks for replying.
I didn't do that.
I only follow readme said: curl https://raw.github.com/marcua/tweeql/master/settings.py.template > settings.py
Then I can successfully running tweeql-command-line.py.
As you wrote in readme,  when running tweeql, the following messages appeared:
TWITTER_USERNAME and TWITTER_PASSWORD not defined in settings.py
Twitter username: (I typed mine correctly)
Twitter password: (I typed mine correctly)
and the prompt tweeql> appeared.

Do you mean I need to edit setting.py and put both username and password in it?


Adam Marcus於 2013年9月11日星期三UTC+8下午11時18分25秒寫道:
Message has been deleted

Veck Hsiao

unread,
Sep 11, 2013, 12:15:41 PM9/11/13
to twe...@googlegroups.com, mar...@marcua.net
I tried it, but still not work.
I'm thinking the possible might be the version of twitter API?
Because from version 1.1 (publish at 2013/03), all authentication should via OAuth?

Veck Hsiao於 2013年9月11日星期三UTC+8下午11時29分02秒寫道:

Adam Marcus

unread,
Sep 11, 2013, 4:46:31 PM9/11/13
to Veck Hsiao, twe...@googlegroups.com
Veck,

That's right.  It looks like the fix is around 10 lines of code, but I don't have the time to push it out and test it now.  Would you be willing to give it a shot?  I can point you in the right direction:

We use tweepy for streaming API access.  Here's an example of how tweepy does OAuth authentication on the streaming API:


Based on that, we have to change the following file in TweeQL:


Specifically, on lines 24-29 we shouldn't be getting usernames/passwords, but instead getting keys/secrets from settings.py as in the tweepy example.  Then on line 38, we have to instantiate an OAuthHandler rather than a BasicAuthHandler.

Do you have the time to make the change and submit a pull request?  If you do, I'll push out a new version, give you credit, and tweet about it.  Thanks!:)

-Adam

Veck Hsiao

unread,
Sep 11, 2013, 10:48:16 PM9/11/13
to twe...@googlegroups.com, Veck Hsiao, mar...@marcua.net

OK!

I'll try to do it.
Thanks you.

Veck

Adam Marcus於 2013年9月12日星期四UTC+8上午4時46分31秒寫道:

Veck Hsiao

unread,
Sep 12, 2013, 5:08:15 AM9/12/13
to twe...@googlegroups.com, Veck Hsiao, mar...@marcua.net
I finished modifying and had made sure that it can work.
Please have a check.
Thanks for giving me a good chance to contribute your project.

Veck

Veck Hsiao於 2013年9月12日星期四UTC+8上午10時48分16秒寫道:
Reply all
Reply to author
Forward
0 new messages