我与谷歌安全浏览API的使用,和下面的代码:python参数取3个参数?哪里?
def getlist(self, type):
dlurl = "safebrowsing.clients.google.com/safebrowsing/downloads?client=api&apikey=" + api_key + "&appver=1.0&pver=2.2"
phish = "googpub-phish-shavar"
mal = "goog-malware-shavar"
self.type = type
if self.type == "phish":
req = urllib.urlopen(dlurl, phish)
data = req.read()
print(data)
产生以下追溯:
File "./test.py", line 39, in getlist
req = urllib.urlopen(dlurl, phish)
File "/usr/lib/python2.6/urllib.py", line 88, in urlopen
return opener.open(url, data)
File "/usr/lib/python2.6/urllib.py", line 209, in open
return getattr(self, name)(url, data)
TypeError: open_file() takes exactly 2 arguments (3 given)
我在做什么错在这里?我无法找到传递3个参数的地方。 顺便说一句,我打电话这跟
x = class()
x.getlist("phish")
谢谢你们。我原来一直在使用httplib,最后决定使用urllib,忘记改变它。非常感激。 – Stev0 2010-10-27 03:45:47
thnaks它帮助我拯救我的屁股! – user993563 2012-04-06 11:13:23