pydoc > cgi

📖 NAME

cgi - Support module for CGI (Common Gateway Interface) scripts.

🚀 Quick Reference

Use CaseCommandDescription
Parse form data (GET/POST)FieldStorage()Read query string or multipart/form-data
Get a single field valueform.getvalue('name')Return value for key, or default
Get first value of a fieldform.getfirst('name')Return first value (if multiple)
Get all values of a fieldform.getlist('name')Return list of values
Dump environment as HTMLprint_environ()Print shell environment variables
Dump form contents as HTMLprint_form(form)Print all form fields
Test CGI scripttest()Run robust test CGI (dumps all info)

📚 MODULE REFERENCE

https://docs.python.org/3.10/library/cgi.html

The following documentation is automatically generated from the Python source files. It may be incomplete, incorrect or include features that are considered implementation detail and may vary between Python implementations. When in doubt, consult the module reference at the location listed above.

📝 DESCRIPTION

This module defines a number of utilities for use by CGI scripts written in Python.

📦 CLASSES

builtins.object
   FieldStorage
   MiniFieldStorage

📘 class FieldStorage

class FieldStorage(builtins.object)
 |  FieldStorage(fp=None, headers=None, outerboundary=b'', environ=environ({...}), keep_blank_values=0, strict_parsing=0, limit=None, encoding='utf-8', errors='replace', max_num_fields=None, separator='&')

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 Python list (if there's multiple values) or another FieldStorage or MiniFieldStorage object. If it's a single object, it has the following attributes:

The class is subclassable, mostly for the purpose of overriding the make_file() method, which is called internally to come up with a file open for reading and writing. This makes it possible to override the default choice of storing all files in a temporary directory and unlinking them as soon as they have been opened.

Methods defined here:

Data descriptors defined here:

Data and other attributes defined here:

📘 class MiniFieldStorage

class MiniFieldStorage(builtins.object)
 |  MiniFieldStorage(name, value)

Like FieldStorage, for use when no file uploads are possible.

Methods defined here:

Data descriptors defined here:

Data and other attributes defined here:

🔧 FUNCTIONS

📊 DATA

__all__ = ['MiniFieldStorage', 'FieldStorage', 'parse', 'parse_multipa...'

🏷️ VERSION

2.6

📁 FILE

/usr/lib/python3.10/cgi.py

cgi
📖 NAME 🚀 Quick Reference 📚 MODULE REFERENCE 📝 DESCRIPTION 📦 CLASSES
📘 class FieldStorage 📘 class MiniFieldStorage
🔧 FUNCTIONS 📊 DATA 🏷️ VERSION 📁 FILE

Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-01 16:50 @216.73.216.239
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^