def url_encode(self, data): """Encodes the provided dictionary Parameters ---------- data : dictionary, mandatory dictionary to be encoded """ return urlencode(data)
def _prepare_service_request_string(json_obj): """ Takes a mashup JSON request object and turns it into a url-safe string. Parameters ---------- json_obj : dict A Mashup request JSON object (python dictionary). Returns ------- response : str URL encoded Mashup Request string. """ requestString = json.dumps(json_obj) requestString = urlencode(requestString) return "request="+requestString
def _prepare_service_request_string(json_obj): """ Takes a mashup JSON request object and turns it into a url-safe string. Parameters ---------- json_obj : dict A Mashup request JSON object (python dictionary). Returns ------- response : str URL encoded Mashup Request string. """ requestString = json.dumps(json_obj) requestString = urlencode(requestString) return "request=" + requestString
def _args_to_url(self, query_string): # convert arguments to a valid requests payload # i.e. a dictionary request_string = 'q=' + urlencode(query_string) return request_string
def _sort_to_url(self): request_sort = '&sort=' + urlencode(self.SORT) return request_sort
def url_encode(self, data): return urlencode(data)