1

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

  • 2
    The `urlfetch` warning is just a warning; I see it when using `urllib2.urlopen` instead of `urlfetch` directly. Under the hood the request is performed by `urlfetch`, which removes the HOST header from `urlopen` request. – snakecharmerb Jun 30 '17 at 10:10
  • My application uses the Web.py templating engine so the call was fatal to the presentation. I had noticed a few days ago that I could access string and integer fields in the JSON data but when attempting to access the business hours, I oddly ran into the same urlfetch warning problem. I presume that the urlfetch pipe remains open for reading my local instance of the data. In my case, I should probably add some error checking to my calls to the data fields. – Steve Kritzer Jun 30 '17 at 14:23

1 Answers1

0

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