In http://gekkoquant.com/2012/05/17/twitter-trading-downloading-tweets-using-python-part-1-of-2/ python code was provided for downloading tweets. The python tweetsteam library was used because python is more compatible than R when using cheap webhosting.
The hosting provider for this site is GoDaddy, they provide python 2.4 and python 2.7 on their basic economy web hosting package. Tweetstream is only compatible with python 2.6 and upwards.
Unfortunately the GoDaddy python 2.7 wasn’t built using the enable ssl options, thus communication over HTTPS which the twitter API requires isn’t possible. Fortunatly I have been able to find a solution which is discussed in this post.
Installing python over SSH and the commandline is normally a straight forward task but since I don’t have root access and there are no compilers available the problem is tricky to solve.
Fortunately it is possible to download pre-compiled python binaries and install them in a folder where I have read/write access. The prebuilt binaries can be found at http://www.activestate.com/activepython/downloads.
wget http://downloads.activestate.com/ActivePython/releases/126.96.36.199/ActivePython-188.8.131.52-linux-x86.tar.gz tar -zxvf ActivePython-184.108.40.206-linux-x86.tar.gz cd ActivePython-220.127.116.11-linux-x86 ./install.ch -bash-3.2$ ./install.sh Enter directory in which to install ActivePython. Leave blank and press 'Enter' to use the default [/opt/ActivePython-2.7]. Install directory: ~/ActivePython () Installing ActivePython to '/var/chroot/home/content/92/9339192/ActivePython'... Relocating dir-dependent files... Pre-compiling .py files in the standard library... ActivePython has been successfully installed to: /var/chroot/home/content/92/9339192/ActivePython You can add the following to your .bashrc (or equivalent) to put ActivePython on your PATH: export PATH=/var/chroot/home/content/92/9339192/ActivePython/bin:$PATH The documentation is available here: /var/chroot/home/content/92/9339192/ActivePython/doc/python2.7/index.html web: http://docs.activestate.com/activepython/2.7 Please send us any feedback you might have or log bugs here: activepython-feedback@ActiveState.com http://bugs.activestate.com/ActivePython/ Thank you for using ActivePython. export PATH=~/ActivePython/bin:$PATH -bash-3.2$ python2.7 ActivePython 18.104.22.168 (ActiveState Software Inc.) based on It should say ACTIVE PYTHON above if install was successful Python 2.7.2 (default, Jun 24 2011, 09:10:09) [GCC 4.0.2 20051125 (Red Hat 4.0.2-8)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import socket >>> socket.ssl <function ssl at 0xb7f21ae4> The above would have throw an error if ssl not installed -bash-3.2$ pip install tweetstream Downloading/unpacking tweetstream Downloading tweetstream-1.1.1.tar.gz Running setup.py egg_info for package tweetstream Downloading/unpacking anyjson (from tweetstream) Downloading anyjson-0.3.1.tar.gz Running setup.py egg_info for package anyjson Installing collected packages: tweetstream, anyjson Running setup.py install for tweetstream Running setup.py install for anyjson Successfully installed tweetstream anyjson Cleaning up... -bash-3.2$ python twit.py 1 ( 0 tweets/sec). FinancialBin : Global stocks fall 5th day, Brent off 2 percent on euro zone fears: NEW YORK (Reuters) - World stocks fell for a... http://t.co/dfWQb3ZL 2 ( 0 tweets/sec). stocksgame : Global stocks fall 5th day, Brent off 2 percent on euro zone fears: NEW YORK (Reuters) - World stocks fell for a... http://t.co/WP92slZt 3 ( 0 tweets/sec). Daily_Finances : #News Global stocks fall 5th day, Brent off 2 percent on euro zone fears http://t.co/flCVonMF 4 ( 0 tweets/sec). AUTSmallBiz : [Sydney Morng Hrld] Stocks set to tumble http://t.co/OEP14YvL 5 ( 0 tweets/sec). BeckaDerrick : @MattoneAwang it's the same price to finance a brand new mini + get free insurance as it is to insure an old car #WhyIsEveryonePuttingMeOff!