Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'json': 0.07; "subject:' ": 0.07; 'urllib2': 0.07; 'welcome.': 0.07; 'promising': 0.09; 'url:blog': 0.10; 'api': 0.11; 'cc:addr:python-list': 0.11; 'between.': 0.16; 'ioerror:': 0.16; 'me.\xa0': 0.16; 'subject:search': 0.16; 'supported.': 0.16; 'then?': 0.16; 'thoughts?': 0.16; 'thread,': 0.16; 'url:json': 0.16; 'url:query': 0.16; 'url:urllib': 0.16; 'urllib': 0.16; 'wrote:': 0.18; 'library': 0.18; 'all,': 0.19; 'trying': 0.19; 'thu,': 0.19; 'url:view': 0.20; 'seems': 0.21; '>>>': 0.22; 'import': 0.22; 'email addr:gmail.com>': 0.22; 'issue.': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'load': 0.23; 'error': 0.23; 'parse': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; "i've": 0.25; 'query': 0.26; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'kevin': 0.30; 'newer': 0.30; 'specified': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'code': 0.31; '13,': 0.31; 'search.': 0.31; 'url:05': 0.31; 'file': 0.32; 'this.': 0.32; 'another': 0.32; 'url:python': 0.33; 'subject:time': 0.33; "i'd": 0.34; 'could': 0.34; 'problem': 0.35; 'basic': 0.35; "can't": 0.35; 'problem.': 0.35; 'point.': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'version': 0.36; 'executing': 0.36; 'url:listinfo': 0.36; 'shows': 0.36; 'thanks': 0.36; 'url:org': 0.36; 'should': 0.36; 'thank': 0.38; 'question,': 0.38; 'url:library': 0.38; 'pm,': 0.38; 'previous': 0.38; 'does': 0.39; 'url:2012': 0.39; 'url:mail': 0.40; 'skip:u 10': 0.60; 'url:%20': 0.61; 'matter': 0.61; 'simple': 0.61; 'more': 0.64; 'url:user': 0.65; 'url:%1': 0.72; '100%': 0.77; 'honest': 0.78; 'subject:get': 0.81; 'off,': 0.84; 'url:50': 0.84; '2013,': 0.91; 'closer.': 0.91; 'subject:results': 0.91; 'differences': 0.93; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=X+dwTPvgyfsMur7Jfo8MFOEDj9XUAVdbXvuCCylOy/4=; b=Sr26VoUFEfaJTBAkmvt6T4KJwt3Ww3u1XkvzDuuE/nH16L+vF5KA4e4CveV8wmOwMx /sBeiKoZCjHABjc2bz2dtVAFdN+Pakbu3Ywer8NcFWD6n8m9oyxDs05ieMen9vATZ+6F VwsGvAZbgt6m9wHIUBfhJLtU+m159QJhze5tGZ02PufPYXopqSsewUwNDnqb3/StCpSC Ln5LwIFyJ7O4IzLFM9WAD95DAGoL7+/pGyMlqNPHM1Ra20qaG9L8RheCOPJG0gmBFNoQ kCZN8jfDUm+UhI7DpwgcsDHy8CO4joMKmN0aTfv+APiijU+JuBAGOleefFksVnJPetOI 146A== MIME-Version: 1.0 X-Received: by 10.180.109.48 with SMTP id hp16mr22370wib.24.1371171613093; Thu, 13 Jun 2013 18:00:13 -0700 (PDT) In-Reply-To: References: Date: Thu, 13 Jun 2013 21:00:13 -0400 Subject: Re: Having a hard time to 'get' bing api search results From: "Yves S. Garret" To: Kevin LaTona Content-Type: multipart/alternative; boundary=e89a8f3ba91decb59104df12c4a9 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 199 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1371171620 news.xs4all.nl 15883 [2001:888:2000:d::a6]:43940 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:48044 --e89a8f3ba91decb59104df12c4a9 Content-Type: text/plain; charset=ISO-8859-1 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 wrote: > > > 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" > wrote: > > 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 wrote: > >> >> 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 = urllib.urlopen(' >> https://user:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA@api.datamarket.azure.com/Bing/SearchWeb/Web?Query=%27xbox%20one%27&$top=50&$format=JSON' >> ) >> >> print f.read() >> >> >> >> IOError: ('http error', 401, 'The authorization type you provided is not >> supported. Only Basic and OAuth are supported', >> >> >> >> >> >> On Jun 13, 2013, at 2:31 PM, Yves S. Garret >> wrote: >> >> 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 S. Garret < >> yoursurrogategod@gmail.com> wrote: >> >>> 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 >> >> >> > > --e89a8f3ba91decb59104df12c4a9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Thanks again Kevin.=A0 I'm deviating from the original= thread,
but I've got another issue.=A0 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<= /a>


On Thu,= Jun 13, 2013 at 6:57 PM, Kevin LaTona <lists@studiosola.com> wrote:

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 url= lib.

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&= quot; <y= oursurrogategod@gmail.com> wrote:

That works beautifully!= =A0 Thank you!

I do have one question, what are urllib and url= lib2 then?=A0 I figured that
urllib2 is a newer version of the previous = library (and one that I should
be using).=A0 Am I missing something?
<= br>
On Thu, Jun 13, 2013 at 6:45 PM, Kevin La= Tona <lists@studiosola.com> wrote:
I did a quick test with url lib instead of urllib2 and got clos= er.

Problem right now is without ID code I can't check = any further.

But it does look promising at this po= int.





print f.read()


=
IOError: ('http error', 401, 'The authorization = type you provided is not supported. =A0Only Basic and OAuth are supported&#= 39;,





=
On Jun 13, 2013, at 2:31 PM, Yves S. Garret <yoursurrogategod@gmail.= com> wrote:

This i= s the format that I've been following:
http://gavinmhackeling.com/blog/2012/05/using-the-bing-search-api-in-pyt= hon/

If I execute the specified query from a browser, the JSON file
shows= up without a problem.=A0 Now, I'd like to do that programmatically.


On Thu= , Jun 13, 2013 at 4:57 PM, Yves S. Garret <yoursurrogategod@gmail= .com> wrote:
Hello all,
This is my dilemma, I'm trying to get the generated JSON file using th= e bing api
search.

This is the code that I'm executing from inside th= e shell:
http://bin.cakephp.org/view/460660617

The port doesn't matter to me.=A0 Thoughts?

--
http://mail.python.org/mailman/listinfo/python-list




--e89a8f3ba91decb59104df12c4a9--