I am passing the given query
http://localhost:8080/show?key=1234&path=host

in my python script i want to take the 'path' only how can i get it?

i use

def get(self):
data = self.request.get('path')

but it not working

Recommended Answers

All 5 Replies

what module are you using?

self.request.get('path')

means nothing

My php firstpage <a href="http://localhost:8080/showcustomer?key=1234&path=host">click</a> My php showcustomerpage

$execute='C:\wamp\bin\apache\Apache2.2.11\cgi-bin\datesname.py';
$start =$_GET["key"];
$end =$_GET["path"];
$go = $start."=".$end."&path=".$end;
exec("$execute $go",$out);

My Pythonpage datesname.py

#!c:/Python27/python.exe -u


import cgi, cgitb, os, sys
import datetime
import logging
from urlparse import parse_qs
cgitb.enable(); # formats errors in HTML

sys.stderr = sys.stdout

query = os.environ.get('QUERY_STRING')
def get(self):
    data = self.request.get('path')
    print data

But i didnt get value

Confusion: The token self is a 'community standard reserved word': It is legal to use as a token, but everybody who codes in Python uses it as the first argument to member functions; and in classes to refer to the class instance it self... and for no other purpose. So your code seems meaningless to those of us who have been programming in Python for more than a few weeks, because we see self and our habits tell us to look for the rest of the class definition.

Your query variable holds a string. In Python, strings have member functions, but no attribute named 'request'.

Iam using django module

def get_full_path(self):
    data = self.request.get('path')

You can always take the part of the string before the ? character...

Look for string.split('?').

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.