
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
What are environment variables available in Python CGI Programming?
CGI Environment Variables
All the CGI programs have access to the following environment variables. These variables play an important role while writing any CGI program.
Sr.No. | Variable Name | Description |
1 | CONTENT_TYPE | The data type of the content. Used when the client is sending attached content to the server. For example, file upload. |
2 | CONTENT_LENGTH | The length of the query information. It is available only for POST requests. |
3 | HTTP_COOKIE | Returns the set cookies in the form of key & value pair. |
4 | HTTP_USER_AGENT | The User-Agent request-header field contains information about the user agent originating the request. It is name of the web browser. |
5 | PATH_INFO | The path for the CGI script. |
6 | QUERY_STRING | The URL-encoded information that is sent with GET method request. |
7 | REMOTE_ADDR | The IP address of the remote host making the request. This is useful logging or for authentication. |
8 | REMOTE_HOST | The fully qualified name of the host making the request. If this information is not available, then REMOTE_ADDR can be used to get IR address. |
9 | REQUEST_METHOD | The method used to make the request. The most common methods are GET and POST. |
10 | SCRIPT_FILENAME | The full path to the CGI script. |
11 | SCRIPT_NAME | The name of the CGI script. |
12 | SERVER_NAME | The server's hostname or IP Address |
13 | SERVER_SOFTWARE | The name and version of the software the server is running. |
- Related Articles
- CGI Environment Variables in Python
- Perl CGI Environment Variables
- What are the modules required for CGI programming in Python?
- What are important HTTP headers to be frequently used in Python CGI Programming?
- Python Environment Variables
- How to do CGI programming in Python?
- How do cookies work in Python CGI Programming?
- How to setup cookies in Python CGI Programming?
- How to retrieve cookies in Python CGI Programming?
- What is the difference between GET and POST in Python CGI Programming?
- How to configure Apache for Python CGI Programming?
- What Environment Variables are required to set in Java Applications?
- What are the effects of language design in the programming environment?
- What is CGI in Python?
- How can import python module in IDE environment available in tutorialspoint?

Advertisements