Re: Having a hard time to 'get' bing api search results

2013-06-14 Thread Kevin LaTona
Queries should be URL encoded; query string should be enclosed in %27 (apostrophe). I was looking at the wrong column on the ascii chart,… so your %27 was correct If you are getting in via a browser than it's url lib thing. You might want to look at Requst lib as a possible option.

Re: Having a hard time to 'get' bing api search results

2013-06-14 Thread Kevin LaTona
I did a quick test with url lib instead of urllib2 and got closer. Problem right now is without ID code I can't check any further. But it does look promising at this point. If all else fails http://docs.python.org/2/library/urllib.html#examples import urllib f =

Re: Having a hard time to 'get' bing api search results

2013-06-14 Thread Kevin LaTona
Your welcome. To be honest I am not 100% on the differences between. I could be off, but I recall urllib2 was a more refined version of urllib. Yet it seems like urllib works better for me, when I need to do a simple call like this. -Kevin On Jun 13, 2013, at 3:50 PM, Yves S. Garret

Re: Having a hard time to 'get' bing api search results

2013-06-14 Thread Yves S. Garret
On Fri, Jun 14, 2013 at 2:04 PM, Kevin LaTona k...@studiosola.com wrote: Sounds like you are missing a closing } json bracket Try a different json validator site to prove your json doc is working. If it's the same doc you sent me last night it worked for me so maybe it got messed up

Re: Having a hard time to 'get' bing api search results

2013-06-14 Thread Andreas Perstinger
On 14.06.2013 20:19, Yves S. Garret wrote: This is the error that I'm getting right now. import json from pprint import pprint path = '/home/azureuser/temp.json' with open(path) as data_file: ... data = json.load(data_file) ... Traceback (most recent call last): File stdin, line 2, in

Having a hard time to 'get' bing api search results

2013-06-13 Thread Yves S. Garret
Hello all, This is my dilemma, I'm trying to get the generated JSON file using the bing api search. This is the code that I'm executing from inside the shell: http://bin.cakephp.org/view/460660617 The port doesn't matter to me. Thoughts? -- http://mail.python.org/mailman/listinfo/python-list

Re: Having a hard time to 'get' bing api search results

2013-06-13 Thread John Gordon
In mailman.3222.1371157061.3114.python-l...@python.org Yves S. Garret yoursurrogate...@gmail.com writes: Hello all, This is my dilemma, I'm trying to get the generated JSON file using the bing api search. This is the code that I'm executing from inside the shell:

Re: Having a hard time to 'get' bing api search results

2013-06-13 Thread j...@studiosola.com
Web?Query=%27xbox%20one%27 Plus do you really want to be sending in a %27 (which is a [ ) vs maybe a %20 (which is a space ) or even a %29 ( which is a ] ) Cross check your URL encoding is correct. -Kevin On Jun 13, 2013, at 2:09 PM, John Gordon gor...@panix.com

Re: Having a hard time to 'get' bing api search results

2013-06-13 Thread Yves S. Garret
This is the format that I've been following: http://gavinmhackeling.com/blog/2012/05/using-the-bing-search-api-in-python/ If I execute the specified query from a browser, the JSON file shows up without a problem. Now, I'd like to do that programmatically. On Thu, Jun 13, 2013 at 4:57 PM, Yves

Re: Having a hard time to 'get' bing api search results

2013-06-13 Thread Yves S. Garret
That works beautifully! Thank you! I do have one question, what are urllib and urllib2 then? I figured that urllib2 is a newer version of the previous library (and one that I should be using). Am I missing something? On Thu, Jun 13, 2013 at 6:45 PM, Kevin LaTona li...@studiosola.com wrote:

Re: Having a hard time to 'get' bing api search results

2013-06-13 Thread Yves S. Garret
Thanks again Kevin. I'm deviating from the original thread, but I've got another issue. When I try to load the json file and then parse it, this is the error that I get: http://bin.cakephp.org/view/1329549559 On Thu, Jun 13, 2013 at 6:57 PM, Kevin LaTona li...@studiosola.com wrote: Your

Re: Having a hard time to 'get' bing api search results

2013-06-13 Thread Andreas Perstinger
On 14.06.2013 03:00, Yves S. Garret wrote: Thanks again Kevin. I'm deviating from the original thread, but I've got another issue. When I try to load the json file and then parse it, this is the error that I get: http://bin.cakephp.org/view/1329549559 1) Please don't top post. Put your