Rajendra Dharmkar has Published 189 Articles

How to configure Apache for Python CGI Programming?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 16-Jun-2020 12:45:17

2K+ Views

Configure Apache Web server for CGITo 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 ScriptAliasYou may set a directory as ScriptAlias Directive (options for configuring Apache). This way, Apache understands ... Read More

How to retrieve cookies in Python CGI Programming?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 16-Jun-2020 12:32:59

973 Views

Retrieving CookiesIt is very easy to retrieve all the set cookies. Cookies are stored in CGI environment variable HTTP_COOKIE and they will have following form −key1 = value1;key2 = value2;key3 = value3....Here is an example of how to retrieve cookies.#!/usr/bin/python # Import modules for CGI handling from os import environ ... Read More

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

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 16-Jun-2020 12:31:23

2K+ Views

GET and POST MethodsYou 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 ... Read More

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

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 16-Jun-2020 12:25:28

352 Views

HTTP HeaderThe line Content-type:text/html\r\r 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 ContentFor ExampleContent-type − text/html\r\rThere are few other important HTTP headers, which we will use frequently in ... Read More

What are the modules required for CGI programming in Python?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 16-Jun-2020 12:21:40

270 Views

Python's cgi module is usually the starting place in writing CGI programs in Python. The main purpose of the cgi module is to extract the values passed to a CGI program from an HTML form. Mostly one interacts with CGI applications through an HTML form. One fills out some values ... Read More

How to pass Text Area Data to Python CGI script?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 16-Jun-2020 12:18:43

821 Views

Passing Text Area Data to CGI ProgramTEXTAREA element is used when multiline text has to be passed to the CGI Program.Here is example HTML code for a form with a TEXTAREA box − Type your text here... The result of this code is the following form −Type ... Read More

How to pass Checkbox Data to Python CGI script?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 16-Jun-2020 12:17:52

546 Views

Passing Checkbox Data to CGI ProgramCheckboxes are used when more than one option is required to be selected.Here is example HTML code for a form with two checkboxes − Maths Physics The result of this code is the following form −Maths  Physics Select SubjectBelow is checkbox.cgi script ... Read More

How to pass Radio Button Data to Python CGI script?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 16-Jun-2020 12:16:41

1K+ Views

Passing Radio Button Data to CGI ProgramRadio Buttons are used when only one option is required to be selected.Here is example HTML code for a form with two radio buttons − Maths Physics The result of this code is the following form − Maths  Physics Select SubjectBelow is ... Read More

How to encode custom python objects as BSON with Pymongo?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 16-Jun-2020 11:29:35

446 Views

To encode custom python objects as BSON with Pymongo, you have to write a SONManipulator. From the docs:SONManipulator instances allow you to specify transformations to be applied automatically by PyMongo.from pymongo.son_manipulator import SONManipulator class Transform(SONManipulator):   def transform_incoming(self, son, collection):     for (key, value) in son.items():       ... Read More

How I can create Python class from JSON object?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 16-Jun-2020 08:38:28

1K+ Views

We can use python-jsonschema-objects which is built on top of jsonschema.The python-jsonschema-objects provide an automatic class-based binding to JSON schemas for use in Python.We have a sample json schema as followsschema = '''{     "title": "Example Schema",     "type": "object",     "properties": {         ... Read More

Previous 1 ... 6 7 8 9 10 ... 19 Next
Advertisements