requests: GAE fails with v2.16.3 | error: required argument is not a float
I have just installed the requests library in my appengine app following the instructions at https://cloud.google.com/appengine/docs/standard/python/issue-requests . When making the following request (within the app or within the interactive console)
import requests
import requests_toolbelt.adapters.appengine
# Use the App Engine Requests adapter. This makes sure that Requests uses
# URLFetch.
requests_toolbelt.adapters.appengine.monkeypatch()
r = requests.get('https://api.github.com/events')
I get the following error
> Traceback (most recent call last):
> File "/usr/local/y/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/request_handler.py", line 226, in handle_interactive_request
> exec(compiled_code, self._command_globals)
> File "<string>", line 8, in <module>
> File "/Users/developer/Desktop/myapp-web/libraries/requests/api.py", line 72, in get
> return request('get', url, params=params, **kwargs)
> File "/Users/developer/Desktop/myapp-web/libraries/requests/api.py", line 58, in request
> return session.request(method=method, url=url, **kwargs)
> File "/Users/developer/Desktop/myapp-web/libraries/requests/sessions.py", line 523, in request
> resp = self.send(prep, **send_kwargs)
> File "/Users/developer/Desktop/myapp-web/libraries/requests/sessions.py", line 643, in send
> r = adapter.send(request, **kwargs)
> File "/Users/developer/Desktop/myapp-web/libraries/requests/adapters.py", line 440, in send
> timeout=timeout
> File "/Users/developer/Desktop/myapp-web/libraries/requests_toolbelt/adapters/appengine.py", line 172, in urlopen
> **response_kw)
> File "/Users/developer/Desktop/myapp-web/libraries/urllib3/contrib/appengine.py", line 149, in urlopen
> validate_certificate=self.validate_certificate,
> File "/usr/local/y/google-cloud-sdk/platform/google_appengine/google/appengine/api/urlfetch.py", line 293, in fetch
> return rpc.get_result()
> File "/usr/local/y/google-cloud-sdk/platform/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 613, in get_result
> return self.__get_result_hook(self)
> File "/usr/local/y/google-cloud-sdk/platform/google_appengine/google/appengine/api/urlfetch.py", line 413, in _get_fetch_result
> rpc.check_success()
> File "/usr/local/y/google-cloud-sdk/platform/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 579, in check_success
> self.__rpc.CheckSuccess()
> File "/usr/local/y/google-cloud-sdk/platform/google_appengine/google/appengine/api/apiproxy_rpc.py", line 157, in _WaitImpl
> self.request, self.response)
> File "/usr/local/y/google-cloud-sdk/platform/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 206, in MakeSyncCall
> self._MakeRealSyncCall(service, call, request, response)
> File "/usr/local/y/google-cloud-sdk/platform/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 255, in _MakeRealSyncCall
> request_pb.set_request(request.Encode())
> File "/usr/local/y/google-cloud-sdk/platform/google_appengine/google/net/proto/ProtocolBuffer.py", line 103, in Encode
> self.Output(e)
> File "/usr/local/y/google-cloud-sdk/platform/google_appengine/google/net/proto/ProtocolBuffer.py", line 347, in Output
> self.OutputUnchecked(e)
> File "/usr/local/y/google-cloud-sdk/platform/google_appengine/google/appengine/api/urlfetch_service_pb.py", line 484, in OutputUnchecked
> out.putDouble(self.deadline_)
> File "/usr/local/y/google-cloud-sdk/platform/google_appengine/google/net/proto/ProtocolBuffer.py", line 592, in putDouble
> a.fromstring(struct.pack("<d", v))
> error: required argument is not a float
I have the following packages installed (along with dependencies) via pip
requests-2.16.3.dist-info
requests_toolbelt-0.8.0.dist-info
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 29 (17 by maintainers)
🍰 Closing this
Testing looks pretty solid so far with 2.17.3. Definitely we aren’t hitting the same issue as before. We are using the global monkey patching in
requests_toolbelt. Confirmed that it’s working both with our own code and with vendored libraries that don’t know about GAE (e.g.,braintree). This is on App Engine Standard.I’ll take a look at this first thing Tuesday when I get back in the office. Thanks!
On Sat, May 27, 2017, 1:22 PM A notifications@github.com wrote: