Computer_Engineer
Computer_Engineer

Reputation: 403

Pass more than one parameter in URL

I tried to pass more than one parameter through URL using python, i wrote as this:

 self.response.out.write("""<html><br><body><center> <li ><a href="download.py?blob_key=%s & width=%s & height=%s" >%s</a></center></body></html>      
""" % (str(blob_key),str(w),str(h), str(name)))

but i can't pass through this method,i don't know the error exactly. Thanks

Upvotes: 0

Views: 476

Answers (1)

Oleh Prypin
Oleh Prypin

Reputation: 34116

The problem here is whitespace. HTTP protocol doesn't tolerate it in request strings.

I would write that like this:

'<a href="download.py?key={}&width={}&height={}">{}</a>'.format(key, w, h, name)

(str.format is the new preferred alternative to str%something).

Upvotes: 3

Related Questions