views:

29

answers:

1

Ok. I've been told by at least one really helpful individual who believes that its easy to decode and parse a GET/POST request header from within CherryPy. I've been here: http://www.cherrypy.org/wiki/BuiltinTools#tools.decode but it doesn't give you an example. Can someone direct me to a more helpful example?

+1  A: 

I guess there are two parts embedded to your question:

1) How to get the headers

cherrypy.request.headers is a dict, you can extract information like any other dictionary

2) How to use the decoding / encoding support provided in tools.decode

@tools.decode(encoding='ISO-88510-1') 
def decodingFunction(self, data):
    return "%s" % (data, )

This will allow you to decode a string using above encoding set. The string returned is unicode. Pass the information you extract from the dictionary to your decoding and encoding functions and you should be able to use this.

pyfunc
Thanks man. That's exactly what I needed. I appreciate it.
Sean Ochoa