Export to GitHub

google-safe-browsing - issue #7

Open source python client doesn't send the apikey parameter on request for full-length hashes.


Posted on May 18, 2010 by Grumpy Lion

Hello, It seems that this implementation doesn't send the apikey parameter on request for full-length hashes. The result is that on queries for blacklisted URLs I get an exception and 403 error ("ServerError: gethash failed: HTTP Error 403: Forbidden")

Adding the apikey parameter fixed the problem for me:

--- server.py.old 2010-05-18 14:08:24.000000000 +0100 +++ server.py 2010-05-18 14:07:46.000000000 +0100 @@ -285,10 +285,15 @@ raise Error('All prefixes must have length: %d' % prefix_length) try: + apikey_param = '' + if self._apikey: + apikey_param = '&apikey=' + self._apikey + resp = self._MakeRequest( Server.GETHASH, postdata='%d:%d\n%s' % (prefix_length, prefix_length * len(prefixes), ''.join(prefixes)), + extra_params=apikey_param, hp=(self._gethash_host, self._gethash_port)) except ServerError, e: orig = e.OriginalError()

Original email thread: http://groups.google.com/group/google-safe-browsing-api/browse_thread/thread/ff2ddd64b2f0db0b? hl=en_US#

Comment #1

Posted on May 18, 2010 by Massive Giraffe

(No comment was entered for this change.)

Comment #2

Posted on Jun 1, 2010 by Massive Giraffe

Fixed in version 0.2.

Status: Fixed

Labels:
Type-Defect Priority-Medium