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

Method __init__

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

Constructor. Read multipart/* until last part. Arguments, all optional: fp : file pointer; default: sys.stdin.buffer (not used when the request method is GET) Can be : 1. a TextIOWrapper object 2. an object whose

(self, fp=None, headers=None, outerboundary=b'',
                 environ=os.environ, keep_blank_values=0, strict_parsing=0,
                 limit=None, encoding='utf-8', errors='replace',
                 max_num_fields=None, separator='&')

Source from the content-addressed store, hash-verified

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:
345 taken from environ as per CGI spec
346
347 outerboundary : terminating multipart boundary
348 (for internal use only)
349
350 environ : environment dictionary; default: os.environ
351
352 keep_blank_values: flag indicating whether blank values in
353 percent-encoded forms should be treated as blank strings.
354 A true value indicates that blanks should be retained as
355 blank strings. The default false value indicates that
356 blank values are to be ignored and treated as if they were
357 not included.
358
359 strict_parsing: flag indicating what to do with parsing errors.
360 If false (the default), errors are silently ignored.
361 If true, errors raise a ValueError exception.
362
363 limit : used internally to read parts of multipart/form-data forms,
364 to exit from the reading loop when reached. It is the difference
365 between the form content-length and the number of bytes already
366 read
367
368 encoding, errors : the encoding and error handler used to decode the
369 binary stream to strings. Must be the same as the charset defined
370 for the page sending the form (content-type : meta http-equiv or
371 header)
372
373 max_num_fields: int. If set, then __init__ throws a ValueError
374 if there are more than n fields read by parse_qsl().
375
376 """
377 method = 'GET'
378 self.keep_blank_values = keep_blank_values
379 self.strict_parsing = strict_parsing
380 self.max_num_fields = max_num_fields
381 self.separator = separator
382 if 'REQUEST_METHOD' in environ:
383 method = environ['REQUEST_METHOD'].upper()
384 self.qs_on_post = None
385 if method == 'GET' or method == 'HEAD':
386 if 'QUERY_STRING' in environ:
387 qs = environ['QUERY_STRING']

Callers

nothing calls this directly

Calls 8

read_urlencodedMethod · 0.95
read_multiMethod · 0.95
read_singleMethod · 0.95
BytesIOClass · 0.90
parse_headerFunction · 0.85
upperMethod · 0.80
typeClass · 0.50
encodeMethod · 0.45

Tested by

no test coverage detected