Changeset 10135 for lang/python/webSimple/webSimple.py
- Timestamp:
- 04/22/08 17:10:38 (7 months ago)
- Files:
-
- 1 modified
-
lang/python/webSimple/webSimple.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/python/webSimple/webSimple.py
r9196 r10135 45 45 query_path = url_param[2] 46 46 query_params = url_param[4] 47 headers = {} 47 48 48 49 if isinstance(opt, dict): 49 50 if opt.has_key('path'): 50 51 query_path += opt['path'] 52 if opt.has_key('headers'): 53 headers.update(opt['headers']) 51 54 52 55 if isinstance(self.opt, dict): … … 55 58 query_params += "&" 56 59 query_params += "%s" % urllib.urlencode(self.opt['param']) 60 if self.opt.has_key('headers'): 61 headers.update(self.opt['headers']) 57 62 58 63 if isinstance(param, dict): … … 63 68 64 69 if use_google_api: 65 return Response(urlfetch.fetch(url ).content)70 return Response(urlfetch.fetch(url, headers=headers).content) 66 71 67 return Response(urllib2.urlopen(urllib2.Request(url )).read())72 return Response(urllib2.urlopen(urllib2.Request(url, headers=headers)).read())
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)