You can access the headers using web.ctx.envrion. Your headers will be
an item in the envrion dict prepended with "HTTP_" and converted to
upper case.
I'm not familiar with modpython_gateway.py and don't know if it will
change this behavior.

example request  (I've recently discovered requests,
http://docs.python-requests.org/en/latest/index.html. It's awesome!)
---------------------------------
import requests
requests.get("http://127.0.0.1:8080/resource";,
headers={"auth_token":"xxxxxxxxxxx"})

web.py code
---------------------------
    def GET(self):
        auth_token = web.ctx.environ["HTTP_AUTH_TOKEN"]


On Feb 8, 6:22 am, mvl <marc.vanle...@googlemail.com> wrote:
> Hello,
>
> I'am searching for a way to authenticate against the api that I have
> written with web.py.
>
> I thought about something like a API-Key/Token that would be included
> in the HTTP headers of the request.
>
> How can I get a specific HTTP-Header with web.py? I'am using
> modpython_gateway.py/mod_python in my production environment.
>
> I have seen the method web.header() - but it seems like that this
> method is only for setting specific response-headers.

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to webpy@googlegroups.com.
To unsubscribe from this group, send email to 
webpy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to