我在谷歌应用引擎项目中运行这些代码。
from boto import cloudfront
con = cloudfront.CloudFrontConnection(
AWS_ACCESS_KEY,
AWS_SECRET_KEY
)
distro_info = con.get_distribution_info(DOWNLOAD_DIST_ID)
当它执行到上面的最后一行时,我收到了一堆警告/错误消息,如下所示:
WARNING 2015-04-22 07:15:58,620 urlfetch_stub.py:504] Stripped prohibited headers from URLFetch request: ['Content-Length', 'Host']
WARNING 2015-04-22 07:15:59,811 urlfetch_stub.py:504] Stripped prohibited headers from URLFetch request: ['Content-Length', 'Host']
WARNING 2015-04-22 07:16:02,105 urlfetch_stub.py:504] Stripped prohibited headers from URLFetch request: ['Content-Length', 'Host']
WARNING 2015-04-22 07:16:05,961 urlfetch_stub.py:504] Stripped prohibited headers from URLFetch request: ['Content-Length', 'Host']
WARNING 2015-04-22 07:16:07,010 urlfetch_stub.py:504] Stripped prohibited headers from URLFetch request: ['Content-Length', 'Host']
WARNING 2015-04-22 07:16:08,088 urlfetch_stub.py:504] Stripped prohibited headers from URLFetch request: ['Content-Length', 'Host']
WARNING 2015-04-22 07:16:29,897 urlfetch_stub.py:504] Stripped prohibited headers from URLFetch request: ['Content-Length', 'Host']
ERROR 2015-04-22 07:17:24,921 webapp2.py:1528] An error occured while connecting to the server: Unable to fetch URL: http://cloudfront.amazonaws.com/2010-11-01/distribution/XXXXX4K3XXXXX Error: [Errno 61] Connection refused
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 1077, in __call__
return handler.dispatch()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "/Users/antkong/dev/test-signed-cookie/testmain.py", line 218, in get
domain, cookies = generate_signed_cookies(s3resource, expire_minutes=expireLen)
File "/Users/antkong/dev/test-signed-cookie/testmain.py", line 107, in generate_signed_cookies
distro_info = con.get_distribution_info(DOWNLOAD_DIST_ID)
File "lib/boto/cloudfront/__init__.py", line 158, in get_distribution_info
return self._get_info(distribution_id, 'distribution', Distribution)
File "lib/boto/cloudfront/__init__.py", line 86, in _get_info
response = self.make_request('GET', uri)
File "lib/boto/connection.py", line 1068, in make_request
retry_handler=retry_handler)
File "lib/boto/connection.py", line 943, in _mexe
response = connection.getresponse()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/dist27/gae_override/httplib.py", line 536, in getresponse
'An error occured while connecting to the server: %s' % e)
error: An error occured while connecting to the server: Unable to fetch URL: http://cloudfront.amazonaws.com/2010-11-01/distribution/XXXXX4K3XXXXX Error: [Errno 61] Connection refused
如果我将它作为独立脚本运行,则根本没有问题。
有谁知道是什么问题?