Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 获取InvalidURLError:ApplicationError:1(在URLFetch中)_Python_Google App Engine_Urlfetch - Fatal编程技术网

Python 获取InvalidURLError:ApplicationError:1(在URLFetch中)

Python 获取InvalidURLError:ApplicationError:1(在URLFetch中),python,google-app-engine,urlfetch,Python,Google App Engine,Urlfetch,我得到以下错误: InvalidURLError: ApplicationError: 1 检查了我的代码,记录了一些事情,url导致这个错误看起来很正常。通过urllib.quote引用它们,通过浏览器访问它们会得到正常结果 错误发生在多个URL上,而不是一个。URL指向API服务,并在应用程序中构建 顺便说一句,这里有一个指向google.appengine.api.urlfetch源代码的链接: docstrings指出,当“如果url无效,则为InvalidURLError”和“如果

我得到以下错误:

InvalidURLError: ApplicationError: 1 
检查了我的代码,记录了一些事情,url导致这个错误看起来很正常。通过urllib.quote引用它们,通过浏览器访问它们会得到正常结果

错误发生在多个URL上,而不是一个。URL指向API服务,并在应用程序中构建

顺便说一句,这里有一个指向google.appengine.api.urlfetch源代码的链接:

docstrings指出,当“如果url无效,则为InvalidURLError”和“如果url为空字符串或明显无效,则抛出urlfetch.InvalidURLError”时会发生错误

为了让那些想测试这一点的人更简单:

url = 'http://api.embed.ly/1/oembed?key=REMOVEDKEY&maxwidth=400&urls=http%3A//V.interesting.As,http%3A//abcn.ws/z26G9a,http%3A//apne.ws/z37VyP,http%3A//bambuser.com/channel/baba-omer/broadcast/2348417,http%3A//bambuser.com/channel/baba-omer/broadcast/2348417,http%3A//bambuser.com/channel/baba-omer/broadcast/2348417,http%3A//bbc.in/xFx3rc,http%3A//bbc.in/zkkLJq,http%3A//billingsgazette.com/news/local/former-president-bush-to-speak-at-billings-fundraiser-in-may/article_f7ef425a-349c-56a9-a399-606b48033f35.html,http%3A//billingsgazette.com/news/local/former-president-bush-to-speak-at-billings-fundraiser-in-may/article_f7ef425a-349c-56a9-a399-606b48033f35.html,http%3A//billingsgazette.com/news/local/friday-forecast-calls-for-cloudy-windy-day-nighttime-snow-possible/article_d3eb3159-68b0-5559-8255-03fce56eaedd.html,http%3A//billingsgazette.com/news/local/gallery-toy-run/collection_f5042a31-bfd4-5f63-a901-2a8c3e8fb26a.html%230,http%3A//billingsgazette.com/news/local/gas-prices-continue-to-drop-in-billings/article_4e8fd07e-0e1e-5c0e-b551-4162b60c4b60.html,http%3A//billingsgazette.com/news/local/gas-prices-continue-to-drop-in-billings/article_713a0c32-32c9-59f1-9aeb-67b8462bbe88.html,http%3A//billingsgazette.com/news/local/gas-prices-continue-to-fall-in-billings-area/article_2bdebf4b-242c-569e-b414-f388a48f4a14.html,http%3A//billingsgazette.com/news/local/gas-prices-dip-below-a-gallon-at-some-billings-stations/article_c7f4d373-dc2b-55c0-b457-10346c0274a6.html,http%3A//billingsgazette.com/news/local/gas-prices-keep-dropping-in-billings-area/article_3666cf9c-4552-5108-9d5c-de2bba12fa3f.html,http%3A//billingsgazette.com/news/local/government-and-politics/city-picks-st-vincent-as-care-provider-for-health-insurance/article_a899f885-15e1-5b98-b899-75acc01e8feb.html,http%3A//billingsgazette.com/news/local/government-and-politics/linder-settles-in-after-first-year-as-sheriff/article_55a9836e-2196-546d-80f0-48bdef717fa3.html,http%3A//billingsgazette.com/news/local/government-and-politics/new-council-members-city-judge-sworn-in/article_bb7ac948-1d45-579c-a057-1323fb2e643d.html'
from google.appengine.api import urlfetch
result = urlfetch.fetch(url=url)
以下是回溯: 回溯(最近一次呼叫最后一次): 文件“”,第1行,在 文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine default.bundle/Contents/Resources/google\u appengine/google/appengine/api/urlfetch.py”,第263行,在获取返回rpc.get\u result()中 文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine default.bundle/Contents/Resources/google\u appengine/google/appengine/api/apiproxy\u stub\u map.py”,第592行,在get\u结果中 返回self.\u获取\u结果\u挂钩(self) 文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine default.bundle/Contents/Resources/google\u appengine/google/appengine/api/urlfetch.py”,第359行,在获取结果中 引发InvalidURLError(str(err)) InvalidURLError:ApplicationError:1


我不知道这是不是很简单,但我却错过了这一切。非常感谢您的意见和想法。谢谢

您的URL太长。

发布的URL是invlid,您可能有国际字符问题。您找到解决方案了吗?我的意思是,如果你可以使用一个大于20148个字符的URL。谢谢谢伊,你知道限制是什么吗?谢谢,根据这个,是2048个字符