Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint
Cover Image
Cover Image
Drag to reposition
Contributed Answers

How to configure Apache for Python CGI Programming?

How to configure Apache for Python CGI Programming?
Answered on 31st Jan, 2018, 0 Views

To get your server run CGI scripts properly, you have to configure your Web server. We will discuss how to configure your Apache web server to run CGI scripts. Using ScriptAlias You may set a directory as ScriptAlias Directive (options for configuring Apache). This way, Apache understands that all the files residing within that directory are CGI scripts. This may be the most simple way to r.....

How to raise a "File Download" Dialog Box in Python CGI Programming?

How to raise a "File Download" Dialog Box in Python CGI Programming?
Answered on 31st Jan, 2018, 0 Views

Sometimes, it is desired that you want to give option where a user can click a link and it will pop up a "File Download" dialogue box to the user instead of displaying actual content. This is very easy and can be achieved through HTTP header.  For example, if you want make a FileName file downloadable from a given link, then its syntax is as follows − ,

How do we do a file upload using Python CGI Programming?

How do we do a file upload using Python CGI Programming?
Answered on 31st Jan, 2018, 0 Views

To upload a file, the HTML form must have the enctype attribute set to multipart/form-data. The input tag with the file type creates a "Browse" button. , The result of this code is the following form − , Here is the script save_file.py to handle file upload − , If you run the above script on Unix/Linux, then you need to take care of replacing file separator as follows, otherwise.....

How to retrieve cookies in Python CGI Programming?

How to retrieve cookies in Python CGI Programming?
Answered on 31st Jan, 2018, 0 Views

It is very easy to retrieve all the set cookies. Cookies are stored in CGI environment variable HTTP_COOKIE and they will have following form − , Here is an example of how to retrieve cookies. , This produces the following result for the cookies set by above script − ,

How to setup cookies in Python CGI Programming?

How to setup cookies in Python CGI Programming?
Answered on 31st Jan, 2018, 0 Views

It is very easy to send cookies to browser. These cookies are sent along with HTTP Header before to Content-type field. Assuming you want to set UserID and Password as cookies. Setting the cookies is done as follows − , From this example, you must have understood how to set cookies. We use Set-Cookie HTTP header to set cookies. It is optional to set cookies attributes like Expires, Do.....

How do cookies work in Python CGI Programming?

How do cookies work in Python CGI Programming?
Answered on 31st Jan, 2018, 0 Views

HTTP protocol is a stateless protocol. For a commercial website, it is required to maintain session information among different pages. For example, one user registration ends after completing many pages. How to maintain user's session information across all the web pages? In many situations, using cookies is the most efficient method of remembering and tracking preferences, purchases, commi.....

What is the difference between GET and POST in Python CGI Programming?

What is the difference between GET and POST in Python CGI Programming?
Answered on 31st Jan, 2018, 0 Views

You must have come across many situations when you need to pass some information from your browser to web server and ultimately to your CGI Program. Most frequently, browser uses two methods two pass this information to web server. These methods are GET Method and POST Method. Passing Information using GET method The GET method sends the encoded user information appended to the page request.....

What are environment variables available in Python CGI Programming?

What are environment variables available in Python CGI Programming?
Answered on 31st Jan, 2018, 0 Views

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  Description1CONTENT_TYPEThe data type of the content. Used when the client is sending attached content to the server. For example, file upload.2CONTENT_LENGTHThe length of the query in.....

What are important HTTP headers to be frequently used in Python CGI Programming?

What are important HTTP headers to be frequently used in Python CGI Programming?
Answered on 31st Jan, 2018, 0 Views

The line Content-type:text/html\r\n\r\n is part of HTTP header which is sent to the browser to understand the content. All the HTTP header will be in the following form − HTTP Field Name: Field Content For Example Content-type: text/html\r\n\r\n There are few other important HTTP headers, which we will use frequently in our CGI Programming.      Sr.No.HeaderDescription1.....

What Content-type is required to write Python CGI program?

What Content-type is required to write Python CGI program?
Answered on 31st Jan, 2018, 0 Views

If we run simple scripts like hello.py, its output is written on the STDOUT file, i.e., screen.  There is one important and extra feature available which is the first line to be printed Content-type:text/html\r\n\r\n. This line is sent back to the browser and it specifies the content type to be displayed on the browser screen. We can write advanced CGI programs using Python. This scrip.....

1 2 3 4 5 6 7 ... 79 Next
loader
Advertisements
Contribution

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.