[tor-bugs] #9003 [Stem]: Twitter example uses deprecated 1.0 API

Tor Bug Tracker & Wiki blackhole at torproject.org
Sat Jun 15 22:12:27 UTC 2013


#9003: Twitter example uses deprecated 1.0 API
-----------------------+----------------------------------------------------
 Reporter:  ovnicraft  |          Owner:  atagar  
     Type:  defect     |         Status:  accepted
 Priority:  minor      |      Milestone:          
Component:  Stem       |        Version:          
 Keywords:             |         Parent:          
   Points:             |   Actualpoints:          
-----------------------+----------------------------------------------------
Description changed by atagar:

Old description:

> I installed stem from pip
> Python 2.7.3
> Fedora 18
> I am running the example To russia with love to reading twitter, i cp &
> paste code then run as tutorial says and get this output:
>

> {{{
> [ovnicraft at hphome test_stem]$ python tor_twitter.py
> Traceback (most recent call last):
>   File "tor_twitter.py", line 32, in <module>
>     'ExitNodes': '{ru}',
>   File "/usr/lib/python2.7/site-packages/stem/process.py", line 259, in
> launch_tor_with_config
>     return launch_tor(tor_cmd, args, torrc_path, completion_percent,
> init_msg_handler, timeout, take_ownership)
>   File "/usr/lib/python2.7/site-packages/stem/process.py", line 155, in
> launch_tor
>     raise OSError("Process terminated: %s" % last_problem)
> OSError: Process terminated: No, it's still there.  Exiting.
>
> }}}

New description:

 Our example for
 [https://stem.torproject.org/tutorials/to_russia_with_love.html#reading-
 twitter reading Twitter feeds] uses the 1.0 version of the Twitter API.
 This API has [https://dev.twitter.com/blog/api-v1-is-retired now been
 deprecated] and queries fail with...

 {{{
 {"errors": [{
   "message": "The Twitter REST API v1 is no longer
               active. Please migrate to API v1.1.
               https://dev.twitter.com/docs/api/1.1/overview.",
   "code": 68
 }]}
 }}}

 This causes our example to fail with...

 {{{
 atagar at morrigan:~/Desktop/stem$ python twitter_script
 Traceback (most recent call last):
   File "twitter_script", line 39, in <module>
     print "%i. %s" % (index + 1, tweet["created_at"])
 TypeError: string indices must be integers
 }}}

 Patches welcome for migrating the example to the 1.1 API!

--

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/9003#comment:4>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list