How I can request a local url in my app engine application?

本秂侑毒 提交于 2019-12-24 09:27:34

问题


I am using Blobs to store json files for my application. What I am trying to achieve is to request an internal url of my application in order to get the relevant file. I have tried urllib, urllib2, urlfetch but every time I am getting a 5 second DeadlineExceededError: 5 timed out error. Is there a way to retrieve my blob in my get request or an alternative for retrieving my data?


回答1:


You don't need to make HTTP requests to yourself in order to read data from the blobstore - you can simply use the BlobReader API.




回答2:


This wouldn't on the development server (but will work on the production server) because its single threaded and you can't do a request to yourself from within a request.

There are several workarounds for your issue:

  1. Use the file write API to store the data.
  2. Use the multithread dev_server (required to switch to python 2.7 + HRD)
  3. Store the file asynchronously using queues or deferred.


来源:https://stackoverflow.com/questions/8915042/how-i-can-request-a-local-url-in-my-app-engine-application

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