How to decode Get / Post Request headers in tuples using Cherry Py?

Ok I was told at least one really useful person who believes that it is easy to decode and parse the GET / POST request header from CherryPy. I was here: http://www.cherrypy.org/wiki/BuiltinTools#tools.decode , but this does not give you an example. Can someone lead me to a more useful example?

+3
source share
1 answer

I think there are two parts to your question:

1) How to get the headers

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

2) /, tools.decode

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

, . unicode. , , , .

+2

Source: https://habr.com/ru/post/1762389/


All Articles