py-bing-search
py-bing-search copied to clipboard
all tests failed
Hey, great library - thanks for doing this.
I'm having a bit of trouble with the auth. I'm sure I'm being a bonehead but I'm stuck.
I followed the directions and got an api key and created the cfg file.
Here's the error log:
$ python setup.py test running test running egg_info writing requirements to py_bing_search.egg-info/requires.txt writing py_bing_search.egg-info/PKG-INFO writing top-level names to py_bing_search.egg-info/top_level.txt writing dependency_links to py_bing_search.egg-info/dependency_links.txt reading manifest file 'py_bing_search.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'py_bing_search.egg-info/SOURCES.txt' running build_ext test_can_search (tests.test_py_bing_search.TestPyBingImageSearch) ... ERROR test_search_all (tests.test_py_bing_search.TestPyBingImageSearch) ... ERROR test_can_search (tests.test_py_bing_search.TestPyBingNewsSearch) ... ERROR test_search_all (tests.test_py_bing_search.TestPyBingNewsSearch) ... ERROR test_can_search (tests.test_py_bing_search.TestPyBingVideoSearch) ... ERROR test_search_all (tests.test_py_bing_search.TestPyBingVideoSearch) ... ERROR test_can_search (tests.test_py_bing_search.TestPyBingWebSearch) ... ERROR test_search_all (tests.test_py_bing_search.TestPyBingWebSearch) ... ERROR
ERROR: test_can_search (tests.test_py_bing_search.TestPyBingImageSearch)
Traceback (most recent call last): File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/tests/test_py_bing_search.py", line 48, in test_can_search result_one = web_bing.search(limit=50) File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/py_bing_search/py_bing_search.py", line 20, in search return self._search(limit, format) File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/py_bing_search/py_bing_search.py", line 149, in _search raise PyBingImageException("Request returned with code %s, error msg: %s" % (r.status_code, r.text)) PyBingImageException: Request returned with code 401, error msg: The authorization type you provided is not supported. Only Basic and OAuth are supported
-------------------- >> begin captured logging << -------------------- requests.packages.urllib3.connectionpool: INFO: Starting new HTTPS connection (1): api.datamarket.azure.com requests.packages.urllib3.connectionpool: DEBUG: "GET /Bing/Search/Image?Query=%27Python%20Software%20Foundation%27&$top=50&$skip=0&$format=json&ImageFilters=%27%27 HTTP/1.1" 401 91 --------------------- >> end captured logging << ---------------------
ERROR: test_search_all (tests.test_py_bing_search.TestPyBingImageSearch)
Traceback (most recent call last): File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/tests/test_py_bing_search.py", line 54, in test_search_all result_one = web_bing.search_all(limit=60) File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/py_bing_search/py_bing_search.py", line 25, in search_all results = self._search(limit, format) File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/py_bing_search/py_bing_search.py", line 149, in _search raise PyBingImageException("Request returned with code %s, error msg: %s" % (r.status_code, r.text)) PyBingImageException: Request returned with code 401, error msg: The authorization type you provided is not supported. Only Basic and OAuth are supported
-------------------- >> begin captured logging << -------------------- requests.packages.urllib3.connectionpool: INFO: Starting new HTTPS connection (1): api.datamarket.azure.com requests.packages.urllib3.connectionpool: DEBUG: "GET /Bing/Search/Image?Query=%27Python%20Software%20Foundation%27&$top=50&$skip=0&$format=json&ImageFilters=%27%27 HTTP/1.1" 401 91 --------------------- >> end captured logging << ---------------------
ERROR: test_can_search (tests.test_py_bing_search.TestPyBingNewsSearch)
Traceback (most recent call last): File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/tests/test_py_bing_search.py", line 86, in test_can_search result_one = web_bing.search(limit=50) File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/py_bing_search/py_bing_search.py", line 20, in search return self._search(limit, format) File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/py_bing_search/py_bing_search.py", line 298, in _search raise PyBingNewsException("Request returned with code %s, error msg: %s" % (r.status_code, r.text)) PyBingNewsException: Request returned with code 401, error msg: The authorization type you provided is not supported. Only Basic and OAuth are supported
-------------------- >> begin captured logging << -------------------- requests.packages.urllib3.connectionpool: INFO: Starting new HTTPS connection (1): api.datamarket.azure.com requests.packages.urllib3.connectionpool: DEBUG: "GET /Bing/Search/News?Query=%27Python%20Software%20Foundation%27&$top=50&$skip=0&$format=json HTTP/1.1" 401 91 --------------------- >> end captured logging << ---------------------
ERROR: test_search_all (tests.test_py_bing_search.TestPyBingNewsSearch)
Traceback (most recent call last): File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/tests/test_py_bing_search.py", line 92, in test_search_all result_one = web_bing.search_all(limit=60) File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/py_bing_search/py_bing_search.py", line 25, in search_all results = self._search(limit, format) File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/py_bing_search/py_bing_search.py", line 298, in _search raise PyBingNewsException("Request returned with code %s, error msg: %s" % (r.status_code, r.text)) PyBingNewsException: Request returned with code 401, error msg: The authorization type you provided is not supported. Only Basic and OAuth are supported
-------------------- >> begin captured logging << -------------------- requests.packages.urllib3.connectionpool: INFO: Starting new HTTPS connection (1): api.datamarket.azure.com requests.packages.urllib3.connectionpool: DEBUG: "GET /Bing/Search/News?Query=%27Python%20Software%20Foundation%27&$top=50&$skip=0&$format=json HTTP/1.1" 401 91 --------------------- >> end captured logging << ---------------------
ERROR: test_can_search (tests.test_py_bing_search.TestPyBingVideoSearch)
Traceback (most recent call last): File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/tests/test_py_bing_search.py", line 67, in test_can_search result_one = web_bing.search(limit=50) File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/py_bing_search/py_bing_search.py", line 20, in search return self._search(limit, format) File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/py_bing_search/py_bing_search.py", line 226, in _search raise PyBingVideoException("Request returned with code %s, error msg: %s" % (r.status_code, r.text)) PyBingVideoException: Request returned with code 401, error msg: The authorization type you provided is not supported. Only Basic and OAuth are supported
-------------------- >> begin captured logging << -------------------- requests.packages.urllib3.connectionpool: INFO: Starting new HTTPS connection (1): api.datamarket.azure.com requests.packages.urllib3.connectionpool: DEBUG: "GET /Bing/Search/Video?Query=%27Python%20Software%20Foundation%27&$top=50&$skip=0&$format=json HTTP/1.1" 401 91 --------------------- >> end captured logging << ---------------------
ERROR: test_search_all (tests.test_py_bing_search.TestPyBingVideoSearch)
Traceback (most recent call last): File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/tests/test_py_bing_search.py", line 73, in test_search_all result_one = web_bing.search_all(limit=60) File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/py_bing_search/py_bing_search.py", line 25, in search_all results = self._search(limit, format) File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/py_bing_search/py_bing_search.py", line 226, in _search raise PyBingVideoException("Request returned with code %s, error msg: %s" % (r.status_code, r.text)) PyBingVideoException: Request returned with code 401, error msg: The authorization type you provided is not supported. Only Basic and OAuth are supported
-------------------- >> begin captured logging << -------------------- requests.packages.urllib3.connectionpool: INFO: Starting new HTTPS connection (1): api.datamarket.azure.com requests.packages.urllib3.connectionpool: DEBUG: "GET /Bing/Search/Video?Query=%27Python%20Software%20Foundation%27&$top=50&$skip=0&$format=json HTTP/1.1" 401 91 --------------------- >> end captured logging << ---------------------
ERROR: test_can_search (tests.test_py_bing_search.TestPyBingWebSearch)
Traceback (most recent call last): File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/tests/test_py_bing_search.py", line 28, in test_can_search result_one = web_bing.search(limit=50) File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/py_bing_search/py_bing_search.py", line 20, in search return self._search(limit, format) File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/py_bing_search/py_bing_search.py", line 68, in _search raise PyBingWebException("Request returned with code %s, error msg: %s" % (r.status_code, r.text)) PyBingWebException: Request returned with code 401, error msg: The authorization type you provided is not supported. Only Basic and OAuth are supported
-------------------- >> begin captured logging << -------------------- requests.packages.urllib3.connectionpool: INFO: Starting new HTTPS connection (1): api.datamarket.azure.com requests.packages.urllib3.connectionpool: DEBUG: "GET /Bing/Search/Web?Query=%27Python%20Software%20Foundation%27&$top=50&$skip=0&$format=json HTTP/1.1" 401 91 --------------------- >> end captured logging << ---------------------
ERROR: test_search_all (tests.test_py_bing_search.TestPyBingWebSearch)
Traceback (most recent call last): File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/tests/test_py_bing_search.py", line 35, in test_search_all result_one = web_bing.search_all(limit=60) File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/py_bing_search/py_bing_search.py", line 25, in search_all results = self._search(limit, format) File "/Users/cuong_williams/Packages/py-bing-search/github/py-bing-search/py_bing_search/py_bing_search.py", line 68, in _search raise PyBingWebException("Request returned with code %s, error msg: %s" % (r.status_code, r.text)) PyBingWebException: Request returned with code 401, error msg: The authorization type you provided is not supported. Only Basic and OAuth are supported
-------------------- >> begin captured logging << -------------------- requests.packages.urllib3.connectionpool: INFO: Starting new HTTPS connection (1): api.datamarket.azure.com requests.packages.urllib3.connectionpool: DEBUG: "GET /Bing/Search/Web?Query=%27Python%20Software%20Foundation%27&$top=50&$skip=0&$format=json HTTP/1.1" 401 91 --------------------- >> end captured logging << ---------------------
Ran 8 tests in 12.605s
FAILED (errors=8)
Can you double check the login / secrets for your credentials?
PyBingImageException: Request returned with code 401, error msg: The authorization type you provided is not supported. Only Basic and OAuth are supported
I am getting the same thing when running the example code. I have a valid API key on Azure for Bing search.
Can you double check that the copy and pasted secret key is 100% correct? The tests are passing for me (though a separate issue has surfaced). But the basic search is seems to be working fine.
Azure cognitive services provides two API keys for Bing Search, I am just copy-pasting the first one. I am trying this for image search, not sure if that should make a difference.
The endpoint for the API key I'm shown is https://api.cognitive.microsoft.com/bing/v5.0
Great. I'll try to get to it this week...but I will do it as soon as i can.
Thanks for your response.
On Mon, Oct 31, 2016 at 2:25 PM, ☠ [email protected] wrote:
Azure cognitive services provides two API keys for Bing Search, I am just copy-pasting the first one. I am trying this for image search, not sure if that should make a difference
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tristantao/py-bing-search/issues/21#issuecomment-257425222, or mute the thread https://github.com/notifications/unsubscribe-auth/AAa_CbKkJvQ2DcFKECgh6TnKtRECaLayks5q5lzWgaJpZM4KGD19 .
@damienstanton if you're using the new API key (version 5.0+ from cognitive service, not Azure Market which is what this package was intended for), you need to use the new package at https://github.com/tristantao/py-ms-cognitive. I know this is an old thread, so I hope you figured it out!