- Timestamp:
- 01/07/09 16:06:34 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ndgCommon/trunk/ndg/common/src/clients/http/generichttpclient.py
r5443 r5445 8 8 from ndg.common.src.lib.utilities import httpify 9 9 10 VALID_HTTP_METHODS = ['POST', 'PUT', 'GET', 'DELETE'] 10 11 class GenericHTTPClient(object): 11 12 ''' … … 30 31 31 32 32 def readURL(self, url, payload = None, headersDict = None ):33 def readURL(self, url, payload = None, headersDict = None, httpMethod = 'GET'): 33 34 ''' 34 35 Retrieve contents of url - or raise IOError if a problem is found … … 36 37 @keyword payload: data to POST in the request 37 38 @keyword headersDict: dict with headers info to use in the request 39 @keyword httpMethod: method to use with http - either GET, PUT, POST or DELETE. 40 Default = 'GET' 38 41 @raise IOError if problem experienced whilst opening url 39 42 @return contents of url … … 49 52 50 53 request=urllib2.Request(url, **inputs) 54 55 if httpMethod not in VALID_HTTP_METHODS: 56 raise ValueError("Unrecognised http method, '%s'" %httpMethod) 57 58 request.get_method = lambda: httpMethod 59 51 60 response='Cannot obtain remote file: ' 52 61 try:
Note: See TracChangeset
for help on using the changeset viewer.