using "request" variable in python web program

sami sami.jan at gmail.com
Mon Oct 22 15:41:55 EDT 2007


> Not exactly - this is the "query string" part of the URI.
> Request and Response are the two messages defined by the HTTP protocol.
> When you type a URL or click on a link or press a button in a page, your
> browser builds the appropiate Request message and sends it to the server.
> After processing, the server emits the Response message, and the browser
> displays it or otherwise processes the response.
>
> --
> Gabriel Genellina

Thanks Paul and Gabriel - I am confused I guess - I do know about the
request/response mechanism, I wrote this app a while ago:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/522983 - I
wrote this app before in C and decoded request/response params using a
sniffer - I ported it to Python since I wanted to learn Python

> The string after "?" in a URL is actually the "query string" and is
> typically exposed as the QUERY_STRING environment variable in CGI. See
> here for more specific details:

This is what is mixing me up - an example given in the source for
Pyfacebook - http://pyfacebook.googlecode.com/svn/trunk/examples/examples.py

def simple_web_app(request, api_key, secret_key):
    fb = Facebook(api_key, secret_key, request.GET['auth_token'])
    fb.auth.getSession()

It seemed to me "request" was a key in a key/value pair string/
dictionary

Anyway, I have the "auth_token" now and I can pass these 3 string
values to as Facebook(<api_key>, <secret_key>, <auth_token>) - and
it's moving along - but I am persevering :) no PHP for me - I hope I
can put up a tut for this afterwards

Thanks again for the help, guys




More information about the Python-list mailing list