bitexploder / pybing Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/pybing
License: Other
Automatically exported from code.google.com/p/pybing
License: Other
Hi All,
I was looking through the source code and I saw this header:
# Copyright (c) 2009 JJ Geewax http://geewax.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish, dis-
# tribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the fol-
# lowing conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
The Google Code project is listed as GPL.
Which license is intended?
-Erik
Original issue reported on code.google.com by [email protected]
on 12 Jun 2009 at 8:40
For example this query:
http://api.search.live.net/json.aspx?Query=ninjas&Version=2.0&AppId=<YOUR_APP_ID
>&Sources=Web&Web.Count=50
returns an exact result count (37-40 right now, likely to change). It appears
that pybing expects this to be >1000 always and doesn't check the actual
returned total count. Iterating through such a query yields hundreds of
repeated results.
Here is an example program that exposes the problem using svn trunk:
#!/usr/bin/env python
from pybing.query import WebQuery
q = WebQuery("<YOUR_APP_ID>", query="ninjas")
results = q.execute()
for result in results:
# outputs 760 results for me = 37 actual results each occuring 20 times
print result.title.encode('utf-8')
Original issue reported on code.google.com by [email protected]
on 4 Jan 2012 at 4:22
This is the example:
from pybing import Bing
bing = Bing('APPID')
resp = bing.search_web('python')
print resp['SearchResponse']['Web']['Total']
Here is the output :
Traceback (most recent call last):
File "test1.py", line 4, in <module>
resp = bing.search_web('python')
File "/home/zz/Desktop/bruteforce/pybing/bing.py", line 48, in search_web
return self.search(query, source_type=constants.WEB_SOURCE_TYPE)
File "/home/zz/Desktop/bruteforce/pybing/bing.py", line 45, in search
return json.loads(contents)
File "/usr/lib/python2.7/json/__init__.py", line 326, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
TypeError: expected string or buffer
I am using python2.7 and the latest pybing
diff --git a/pybing/bing.py b/pybing/bing.py
index 3063e6b..4fd68bc 100644
--- a/pybing/bing.py
+++ b/pybing/bing.py
@@ -40,7 +40,7 @@ class Bing(object):
query_string = urllib.urlencode(kwargs)
contents = urllib2.urlopen(constants.JSON_ENDPOINT + '?' + query_string
- return json.loads(contents)
+ return json.loads(contents.read())
def search_web(self, query):
return self.search(query, source_type=constants.WEB_SOURCE_TYPE)
Original issue reported on code.google.com by [email protected]
on 17 Feb 2012 at 2:21
Program crashes running
query = WebQuery('<key>', query="coffee")
results = query.execute()
print len(results)
for r in results:
print repr(r.description)
Traceback (most recent call last):
File "bingsearch.py", line 10, in <module>
for r in results:
File "/Users/[me]/.pylibs/pybing-0.1dev_r34-py2.6.egg/pybing/resultset.py", line 120, in __iter__
query = query.set_offset(query.offset + query.count)
I'm nearly positive the problem is that line 107:
query.set_count(constants.MAX_PAGE_SIZE)
should instead read
query = query.set_count(constants.MAX_PAGE_SIZE)
Bitten by your funny immutable setter!
Original issue reported on code.google.com by [email protected]
on 14 Apr 2011 at 7:27
[deleted issue]
Can you modify Bing.search to be
def search(self, query, source_type=None, api_version=None, more=None,
**kwargs):
kwargs.update(more)
so that it would be possible to pass 'Web.Count' and 'Web.Offset' as parameters
by using
more={'Web.Count':50,'Web.Offset':0}?
Original issue reported on code.google.com by [email protected]
on 27 Jan 2011 at 6:34
From 26/06/2013, it looks like you cannot generate AppIDs anymore. Microsoft is
now issuing "application keys" that work in a different way. Do you plan to
support this in any way? At the moment pybing is completely unusable for new
users.
Original issue reported on code.google.com by [email protected]
on 21 Jul 2013 at 7:30
The function is
def get_search_response(self):
json = self._get_url_contents(self.get_request_url())
return json.loads(json)['SearchResponse'][self.SOURCE_TYPE]
but should be something like
def get_search_response(self):
json_string = self._get_url_contents(self.get_request_url())
return json.loads(json_string)['SearchResponse'][self.SOURCE_TYPE]
so that the json module doesn't get overwritten.
Original issue reported on code.google.com by [email protected]
on 10 Dec 2009 at 9:19
Hi All,
First off, great job with the API.
Python 2.6 includes the simplejson under the name 'json'
proposed:
{{{
import urllib
import httplib2
try:
import json
except ImportError:
import simplejson
}}}
Thanks!
-Erik
Original issue reported on code.google.com by [email protected]
on 12 Jun 2009 at 8:37
pybing has a page on PyPI (http://pypi.python.org/pypi/pybing/) but is not
installable via easy_install/pip, because it cannot find any package downloads:
pip install pybing
Downloading/unpacking pybing
Could not find any downloads that satisfy the requirement pybing
No distributions at all found for pybing
Original issue reported on code.google.com by [email protected]
on 4 Jan 2012 at 2:12
What steps will reproduce the problem?
1. Running the example code with an API key.
2.
3.
What is the expected output? What do you see instead?
KeyError: 'Web'
What version of the product are you using? On what operating system?
Pybing latest. win32 py2.7
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 23 Apr 2013 at 11:08
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.