juliensobrier / google-safe-browsing-lookup-python Goto Github PK
View Code? Open in Web Editor NEWPython library for Google Safe Browsing v2 Lookup API
Python library for Google Safe Browsing v2 Lookup API
Julien,
I'm unable to get the library working, I always get the following error: "TypeError: unhashable type: 'list'".
Here is the code to reproduce:
from safebrowsinglookup import SafebrowsinglookupClient
api_key = 'mykey'
gsb = SafebrowsinglookupClient(api_key, 1, 1)
urls = [ 'www.google.com', 'ianfette.org' ]
gsb.lookup(urls)
And the stack trace (with my API key stripped out):
export PYTHONPATH=/tmp/gsb/google-safe-browsing-lookup-python && ./1.py
BODY:
1
http://['www.google.com', 'ianfette.org']
URL: https://sb-ssl.google.com/safebrowsing/api/lookup?client=python&apikey=mykey&appver=0.1&pver=3.0
No match
Traceback (most recent call last):
File "./1.py", line 34, in
x=gsb.lookup(urls)
File "/tmp/gsb/google-safe-browsing-lookup-python/safebrowsinglookup.py", line 106, in lookup
results.update( self.__ok(inputs) )
File "/tmp/gsb/google-safe-browsing-lookup-python/safebrowsinglookup.py", line 163, in __ok
results.update({url: 'ok'})
TypeError: unhashable type: 'list'
Compilation exited abnormally with code 1 at Thu Apr 4 10:16:15
I tested against latest Git.
Can you tell me how to use the lib?
Regards,
In [9]: c = SafebrowsinglookupClient(apikey, 1, 1)
In [10]: c.lookup(*['https://www.google.com/'])
BODY:
1
https://www.google.com/
URL: https://sb-ssl.google.com/safebrowsing/api/lookup?client=python&apikey=XXXXXXXXXXXXXXXXXXXXXX&appver=0.1&pver=3.0
At least 1 match
Number of URLs in the response does not match the number of URLs in the request
1 / 0
Out[10]: {'https://www.google.com/': 'error'}
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.