Hardware Reference
In-Depth Information
Connecting to Twitter
he python-twitter module makes it very easy to read from Twitter. Unfortunately the
module isn't prepackaged for Debian Linux. Luckily it's not too difficult to build it from source
and doing so will give you good experience that will come in handy if you need to install another
module in the future. You'll also see what it's like to use someone else's module, which will be
an advantage if you write modules that you want other people to reuse. You'll discover that it is
just as important to write good documentation as it is to write good code.
Building and Installing Python Modules
The module's home page http://code.google.com/p/python-twitter contains a summary of
how to build the module. If you've never built a module before then you're better off follow-
ing the more detailed steps in this chapter.
The website lists dependencies; these are other modules that must be built first. python-
twitter requires simplejson, httplib2 and python-oauth2 to be installed. Step-by-step instal-
lation instructions are provided in this chapter.
It's possible to download files from the command line in Linux without using a web browser.
There are two programs to choose from: either curl or wget . Both provide similar functionality,
so deciding which one to use comes down to personal preference and/or availability. wget is
used for the examples in this chapter.
TIP
simplejson
Clicking the http://cheeseshop.python.org/pypi/simplejson link redirects you to http://
pypi.python.org/pypi/simplejson.
Note that the version numbers may be different as the library is updated, in which case, you
should replace simplejson-3.3.0.tar.gz with whatever filename you have downloaded.
TIP
Using tar
You can create your own zipped archives by typing the following:
tar czvf <archivename.tar.gz> <list of files and directories>
Tar has many different options, but in most cases czvf , xvf or tvf will be sufficient. t , c
and x mean test (list the contents of an archive), compress and expand an archive, respec-
tively. v indicates that tar should be verbose and list the files as it expands them. f is used
to specify the filename of the archive.
 
Search WWH ::




Custom Search