py-ms-cognitive
py-ms-cognitive copied to clipboard
NameError: global name 'r' is not defined
/Users/erik/.virtualenvs/proj/lib/python2.7/site-packages/py_ms_cognitive/py_ms_cognitive_search/py_ms_cognitive_search.pyc in search(self, limit, format)
69 def search(self, limit=50, format='json'):
70 ''' Returns the result list, and also the uri for next page (returned_list, next_uri) '''
---> 71 return self._search(limit, format)
72
73 def search_all(self, quota=50, format='json'):
/Users/erik/.virtualenvs/proj/lib/python2.7/site-packages/py_ms_cognitive/py_ms_cognitive_search/py_ms_cognitive_web_search.pyc in _search(self, limit, format)
34 QueryChecker.check_web_params(payload, headers)
35 response = requests.get(self.QUERY_URL, params=payload, headers=headers)
---> 36 json_results = self.get_json_results(response)
37 packaged_results = [WebResult(single_result_json) for single_result_json in json_results.get("webPages", {}).get("value", [])]
38 self.current_offset += min(50, limit, len(packaged_results))
/Users/erik/.virtualenvs/proj/lib/python2.7/site-packages/py_ms_cognitive/py_ms_cognitive_search/py_ms_cognitive_search.pyc in get_json_results(self, response)
61 except ValueError as vE:
62 if not self.silent_fail:
---> 63 raise PyMsCognitiveWebSearchException("Request returned with code %s, error msg: %s" % (r.status_code, r.text))
64 else:
65 print ("[ERROR] Request returned with code %s, error msg: %s. \nContinuing in 5 seconds." % (r.status_code, r.text))
NameError: global name 'r' is not defined
I've got a fix pull-request pending here.