Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: global name 'r' is not defined #27

Open
erikcw opened this issue Aug 15, 2017 · 1 comment
Open

NameError: global name 'r' is not defined #27

erikcw opened this issue Aug 15, 2017 · 1 comment

Comments

@erikcw
Copy link

erikcw commented Aug 15, 2017


/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
rtruxal added a commit to rtruxal/py-ms-cognitive that referenced this issue Sep 6, 2017
…uding: explicit default val for `json_result` & a py3-compat rawstring error.
@rtruxal
Copy link
Contributor

rtruxal commented Sep 6, 2017

I've got a fix pull-request pending here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants