File tree 1 file changed +8
-8
lines changed
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change 2
2
# @Author: lnxg33k
3
3
# @Date: 2014-10-08 03:47:26
4
4
# @Last Modified by: lnxg33k
5
- # @Last Modified time: 2014-10-12 17 :35:21
5
+ # @Last Modified time: 2014-10-12 20 :35:28
6
6
7
7
"""
8
8
In order to interact with the Safe Browsing lookup server,
16
16
5. Click on Create new key and create a browser or server key.
17
17
"""
18
18
19
- from requests import request
19
+ from urllib2 import Request , urlopen
20
20
from sys import argv
21
21
from json import dumps
22
22
@@ -37,14 +37,14 @@ def lookUp(domains=[]):
37
37
result = {}
38
38
chunked_domains = chunks (domains )
39
39
for chunk in chunked_domains :
40
+ data = "%s\n %s" % (len (chunk ), "\n " .join (chunk ))
40
41
try :
41
- r = request (
42
- 'POST' ,
43
- url , data = "%s\n %s" % (len (chunk ), "\n " .join (chunk ))
44
- )
45
- if r .status_code == 200 :
42
+ req = Request (url , data )
43
+ r = urlopen (req )
44
+ if r .code == 200 :
46
45
result .update (dict (zip (
47
- chunk , map (lambda n : {'google' : n }, r .content .splitlines ()))
46
+ chunk ,
47
+ map (lambda n : {'google' : n }, map (str .strip , r .readlines ())))
48
48
))
49
49
except :
50
50
pass
You can’t perform that action at this time.
0 commit comments