Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

python3 http requests timeout on GAE

```
def urltest(request😞
    import requests
    response1 = requests.get(url1)
    logger.info(f"get to google : {response1}")
    response2 = requests.get(url2)
    logger.info(f"get to publicbin : {response2}")
    response3 = requests.post(url3, data={'key1': 'value1', 'key2': 'value2'})
    response3.raise_for_status()
    logger.info(f"post to publicbin : {response3}")
    return HttpResponse(response1.text + response2.text + response3.text)
```

http request to outside always timeout on GAE with no log except timeout even tho it's only sending 2 words

requests.get to google is fine

post and get works ok on local

edit1: formating + gae log
edit2: new discovery
gae log calling urltestgae log calling urltest
0 2 768
2 REPLIES 2

Hi @vincenttalenta,

Welcome to Google Cloud Community!

There are a few possible reasons why your requests.post() calls might be timing out on Google App Engine (GAE), but requests.get() calls are working fine:

  • GAE has different timeouts for different types of requests. By default, GAE will timeout requests after 10 minutes, but POST requests have a shorter timeout of 60 seconds.
  • Your POST request might be hitting a rate limiter.
  • Your POST request might be sending a large body.

    To troubleshoot the issue, you can try the following:
  • Increase the timeout for your POST requests.
  • Check the server logs for any errors.
  • Reduce the size of the body of your POST requests.

    If you are still having problems, you can contact Google Cloud support for assistance.

Here are some additional tips for using requests on GAE:

  • Use a timeout on all of your requests, even GET requests.
  • Use a connection pool to reduce the overhead of creating and closing connections to the server.
  • Use a retry mechanism to retry requests that fail due to network errors or other transient errors.

on local that post request took 1 sec? i have added log screenshot... nothing logged except timeout... i only send 2 words as testing and that also failed