MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / FieldStorage

Class FieldStorage

tools/python-3.11.9-amd64/Lib/cgi.py:287–847  ·  view source on GitHub ↗

Store a sequence of fields, reading multipart/form-data. This class provides naming, typing, files stored on disk, and more. At the top level, it is accessible like a dictionary, whose keys are the field names. (Note: None can occur as a field name.) The items are either a Py

Source from the content-addressed store, hash-verified

285
286
287class FieldStorage:
288
289 """Store a sequence of fields, reading multipart/form-data.
290
291 This class provides naming, typing, files stored on disk, and
292 more. At the top level, it is accessible like a dictionary, whose
293 keys are the field names. (Note: None can occur as a field name.)
294 The items are either a Python list (if there's multiple values) or
295 another FieldStorage or MiniFieldStorage object. If it's a single
296 object, it has the following attributes:
297
298 name: the field name, if specified; otherwise None
299
300 filename: the filename, if specified; otherwise None; this is the
301 client side filename, *not* the file name on which it is
302 stored (that's a temporary file you don't deal with)
303
304 value: the value as a *string*; for file uploads, this
305 transparently reads the file every time you request the value
306 and returns *bytes*
307
308 file: the file(-like) object from which you can read the data *as
309 bytes* ; None if the data is stored a simple string
310
311 type: the content-type, or None if not specified
312
313 type_options: dictionary of options specified on the content-type
314 line
315
316 disposition: content-disposition, or None if not specified
317
318 disposition_options: dictionary of corresponding options
319
320 headers: a dictionary(-like) object (sometimes email.message.Message or a
321 subclass thereof) containing *all* headers
322
323 The class is subclassable, mostly for the purpose of overriding
324 the make_file() method, which is called internally to come up with
325 a file open for reading and writing. This makes it possible to
326 override the default choice of storing all files in a temporary
327 directory and unlinking them as soon as they have been opened.
328
329 """
330 def __init__(self, fp=None, headers=None, outerboundary=b'',
331 environ=os.environ, keep_blank_values=0, strict_parsing=0,
332 limit=None, encoding='utf-8', errors='replace',
333 max_num_fields=None, separator='&'):
334 """Constructor. Read multipart/* until last part.
335
336 Arguments, all optional:
337
338 fp : file pointer; default: sys.stdin.buffer
339 (not used when the request method is GET)
340 Can be :
341 1. a TextIOWrapper object
342 2. an object whose read() and readline() methods return bytes
343
344 headers : header dictionary-like object; default:

Callers 2

parse_multipartFunction · 0.85
testFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected