Index of /twitter

[ICO]NameLast modifiedSizeDescription

[DIR]Parent Directory  -  
[   ]Makefile22-Jan-2012 16:13 2.7K 
[   ]README.htaccess23-Jan-2012 00:55 662  
[TXT]README.html03-Jan-2012 00:25 1.7K 
[TXT]ads.html17-Jan-2012 01:57 286  
[   ]apache.conf22-Jan-2012 22:22 852  
[DIR]certlogin/22-Jan-2012 21:32 -  
[TXT]dynamicdrive_3_columns.css17-Jan-2012 16:34 1.2K 
[DIR]images/29-Nov-2011 02:52 -  
[TXT]job.txt22-Nov-2011 02:10 152  
[TXT]pytest.py04-Jan-2012 23:47 5.1K 
[TXT]test.cgi13-Jan-2012 02:20 56  
[TXT]todo.txt19-Jan-2012 03:41 144  
[TXT]twitter_oauth.cgi21-Jan-2012 00:42 19K 
[TXT]twitter_oauth.py21-Jan-2012 00:42 19K 

This is a simple example of using "straight" (no external libraries) Python to implement Twitter's OAuth signin. Once you've set up the .netrc file for www-data (see Makefile), make webtest might work for you, at least on Debian.

Example recipes check and check2 in Makefile are from https://dev.twitter.com/docs/auth/implementing-sign-twitter.

Some things that may not be obvious: README.htaccess is simply a symlink to the otherwise-invisible .htaccess file; and twitter_oauth.py must be symlinked to index.cgi in order to function by default. I have it disabled here so the directory contents may be viewed.

Found out that Google Chrome cannot be relied upon to use the same port number for successive requests. Will need to use cookies instead to maintain state, unless I can come up with another reliable method. (Update 2012-01-02: considering that this was a bad idea anyway. Suppose a malicious entity controls a public AP, and can control the NAT mapping of port numbers.)

This script stores user data in $HOME/members/. If you've set www-data's home directory in /etc/apache2/, or somewhere else out of the document root, you may need to, as root:

 mkdir /etc/apache2/members
 chown www-data.www-data /etc/apache2/members
 chmod 700 /etc/apache2/members
 

pytest is a python-fuse filesystem for testing functions in a Python script, eliminating the need to symlink the script multiple times for each function one wishes to test.