Utility functions to handle HTTP data
Represent a file uploaded in an HTTP form submission
Save the upload to the file object or path fileob
Parameters: | fileob – a file-like object open for writing, or the path to the file to be written |
---|
Represent HTTP request message headers
No Content-Length header given
Return a pesto.response.Response object to represent this error condition
Error encountered while parsing the HTTP request
Return a pesto.response.Response object to represent this error condition
Request body is too big
Return a pesto.response.Response object to represent this error condition
Return s with surrounding quotes removed. Example usage:
>>> dequote('foo')
'foo'
>>> dequote('"foo"')
'foo'
Given a header, return a tuple of (value, [(parameter_name, parameter_value)]).
Example usage:
>>> parse_header("text/html; charset=UTF-8")
('text/html', {'charset': 'UTF-8'})
>>> parse_header("multipart/form-data; boundary=---------------------------7d91772e200be")
('multipart/form-data', {'boundary': '---------------------------7d91772e200be'})
Parse data encoded as multipart/form-data. Generate tuples of:
(<field-name>, <data>)
Where data will be a string in the case of a regular input field, or a FileUpload instance if a file was uploaded.
Parameters: |
|
---|
Parse the contents of an HTTP POST request, which may be either application/x-www-form-urlencoded or multipart/form-data encoded.
Returned items are either tuples of (name, value) for simple string values or (name, FileUpload) for uploaded files.
Parameters: |
|
---|
Return (key, value) pairs from the given querystring:
>>> list(parse_querystring('green%20eggs=ham;me=sam+i+am'))
[(u'green eggs', u'ham'), (u'me', u'sam i am')]
Parameters: |
|
---|