A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cloud.google.com/appengine/docs/legacy/standard/python/outbound-requests below:

URL Fetch for legacy bundled services | App Engine standard environment for Python 2

URL Fetch for legacy bundled services

Stay organized with collections Save and categorize content based on your preferences.

This page describes how App Engine applications use the URL Fetch service to issue HTTP and HTTPS requests and receive responses. To see code samples demonstrating how to issue HTTP and HTTPS requests from your App Engine application, see Issuing HTTP(S) Requests.

If you have set up Serverless VPC Access or if you use the Sockets API, you need to stop URL Fetch from handling requests. URL Fetch causes requests to your VPC network or to the Sockets API to fail. After you disable URL Fetch, the standard Python library will handle HTTP requests. If you need the features provided by URL Fetch for specific requests, you can use the urlfetch library directly for those specific requests.

This API is supported for first-generation runtimes and can be used when upgrading to corresponding second-generation runtimes. If you are updating to the App Engine Python 3 runtime, refer to the migration guide to learn about your migration options for legacy bundled services. Requests

App Engine uses the URL Fetch service to issue outbound requests. In Python, you can use the

httplib

,

urllib

, and

urllib2

libraries to make HTTP requests; in an App Engine application, each library will perform these requests by using the URL Fetch service. You can also use the

urlfetch

library directly.

Request protocols

An application can fetch a URL using either HTTP or HTTPS. The protocol that should be used is inferred by looking at the protocol in the target URL.

The URL to be fetched can use any port number in the following ranges:

If the port is not mentioned in the URL, the port is implied by the protocol. HTTP requests occur on port 80, and HTTPS requests occur on port 443.

Request methods

If you issue requests through the URL Fetch service, you can use any of the following HTTP methods:

A request can include HTTP headers and, for POST, PUT, and PATCH requests, a payload.

Request proxying

Note that the URL Fetch service uses an HTTP/1.1 compliant proxy to fetch the result.

To prevent an application from causing an endless recursion of requests, a request handler is not allowed to fetch its own URL. It is still possible to cause an endless recursion with other means, so exercise caution if your application can be made to fetch requests for URLs supplied by the user.

Your application can set HTTP headers for the outgoing request.

When sending an HTTP POST request, if a Content-Type header is not set explicitly, the header is set to x-www-form-urlencoded. This is the content type used by web forms.

For security reasons, the following headers cannot be modified by the application:

These headers are set to accurate values by App Engine as appropriate. For example, App Engine calculates the Content-Length header from the request data and adds it to the request prior to sending.

The following headers indicate the application ID of the requesting app:

Request timeouts

You can set a deadline, or timeout, for a request. By default, the timeout for a request is 10 seconds.

You can send synchronous requests and asynchronous requests. The following behavior applies to the URL Fetch API:

Secure connections and HTTPS

Your application can fetch a URL securely by using HTTPS to connect to secure servers. Request and response data are transmitted over the network in encrypted form.

By default, the URL Fetch proxy validates the host it contacts. This behavior allows the API to detect man-in-the-middle attacks between App Engine and the remote host when using HTTPS.

Note: The urllib module doesn't provide methods to validate hosts. Responses

If you use the URL Fetch API, note that the URL Fetch service returns all response data, including the response, code, headers, and body.

By default, if the URL Fetch service receives a response with a redirect code, the service will follow the redirect. The service will follow up to five redirect responses, then return the final resource. You can instruct the URL Fetch service to not follow redirects and instead return a redirect response to the application.

Note: The URL Fetch API imposes response size limits. If the incoming response exceeds the maximum response size limit, the URL Fetch service raises an exception. See the Quotas and limits section for details.

You can instruct the URL Fetch API to truncate the response instead of raising an exception. If you use the urllib, urllib2, or httplib libraries to fetch URLs, the response is always truncated, and no exception is raised.

Using URL Fetch on the development server

When your application is running on the App Engine development server on your computer, calls to the URL Fetch service are handled locally. The development server fetches URLs by contacting remote hosts directly from your computer, using whatever network configuration your computer is using to access the Internet.

When testing the features of your application that fetch URLs, make sure that your computer can access the remote hosts.

Quotas and limits for URL Fetch

For information about URL Fetch service quotas, see Quotas. To see the current quota usage of your application, go to the Quota Details page in the Google Cloud console.

Go to the Quota Details page

In addition, the following limits apply to the use of the URL Fetch service:

Limit Amount Request size 10 megabytes Request header size 16 KB (Note that this limits the maximum length of the URL that can be specified in the header) Response size 32 megabytes What's next

Run code samples and get guidance on how to issue requests from your application in Issuing HTTP(S) Requests.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["App Engine applications utilize the URL Fetch service to make both HTTP and HTTPS requests, and this service is also accessible directly through the `urlfetch` library."],["The URL Fetch service can be disabled when using Serverless VPC Access or the Sockets API to prevent request failures, allowing the standard Python library to handle HTTP requests, and the `urlfetch` library can be selectively used when specific URL Fetch features are needed."],["The service supports various HTTP methods like GET, POST, PUT, HEAD, DELETE, and PATCH, with the ability to include custom HTTP headers and a payload for certain methods."],["When making requests through the URL Fetch service, certain headers such as `Content-Length`, `Host`, and `X-Appengine-Inbound-Appid` cannot be modified by the application and are managed by App Engine."],["The URL Fetch service has limitations on request and response sizes, specifically, requests are limited to 10 megabytes, request header size to 16KB, and response size to 32 megabytes, with the option to truncate responses rather than raise an exception."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4