Google App Engine Ubuntu 14.04 urlfetch 500 / 200 issue (Python 2.7)

这一生的挚爱 提交于 2019-12-24 06:29:20

问题


I hope this saves somebody some time. Posting because I found very little concerning URLFetch error.

I was suddenly receiving "WARNING 2017-06-28 23:09:40,971 urlfetch_stub.py:550] Stripped prohibited headers from URLFetch request: ['Host']" on a working Google Places Application.

The update for Google Cloud SDK 161.0.0 was kind enough to inform me that my version of Python was out of date. Ubuntu 14.04 is frozen at Python v. 2.7.6

sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
sudo apt-get update

App engine is currently on Python 2.7.12, I tried compiling the source, but it would not install, had success with this package and looks like it is at the end of support.

sudo add-apt-repository ppa:fkrull/deadsnakes-python2.7
sudo apt-get update 
sudo apt-get install python2.7

I had to repeat the update and install steps several times to get the package to install. (Apparently, dependencies have other dependencies.)

python -V

should return: Python 2.7.12


回答1:


As a follow up, after installing python 2.7.12. I started receiving informational warnings from the App Engine interpreter (.local) looking for a file named "mime.types" in various locations.

INFO     2017-07-02 15:57:25,701 stubs.py:50] Sandbox prevented access to file "/etc/httpd/mime.types"
INFO     2017-07-02 15:57:25,701 stubs.py:51] If it is a static file, check that `application_readable: true` is set in your app.yaml

In stubs.py, App Engine loops through "mimetypes.knownfiles" looking for suggested locations of the file (different by OS). In Ubuntu 14.04 the file is located in the primary [0] position, /etc/mime.types.

The data for the list (of suggested search locations) is found in knownfiles = [] in /usr/lib/python2.7/mimetypes.py

https://docs.python.org/2/library/mimetypes.html



来源:https://stackoverflow.com/questions/44837374/google-app-engine-ubuntu-14-04-urlfetch-500-200-issue-python-2-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!