我想一些文字传递给该readability API像这样:的Python:KeyError异常/ IO错误使用了urllib.urlopen
text = 'this reminds me of the Dutch 2001a caravan full of smoky people Auld Lang Syne'
# construct Readability Metrics API url
request_url = 'http://ipeirotis.appspot.com/readability/GetReadabilityScores?format=json&text=%s' % text
request_url = urllib.quote_plus(request_url.encode('utf-8'))
# make request
j = json.load(urllib.urlopen(request_url))
我得到这个错误在最后一行,但:
[错误2]没有这样的文件或目录:'http://ipeirotis.appspot.com/readability/GetReadabilityScores?format=json & text = this +提醒我+ +荷兰语+ 2001a + caravan + full + of + smoky +人+ Auld + Lang + Syne'
但是,错误中的URL有效,并在您访问时返回响应。如何编码URL以便我可以使用urlopen?非常感谢。
打我吧:) –
非常感谢,这使得更有意义! – soulprovidr