MCPcopy Index your code
hub / github.com/googleapis/google-api-python-client / HttpRequest

Class HttpRequest

googleapiclient/http.py:823–1162  ·  view source on GitHub ↗

Encapsulates a single HTTP request.

Source from the content-addressed store, hash-verified

821
822
823class HttpRequest(object):
824 """Encapsulates a single HTTP request."""
825
826 @util.positional(4)
827 def __init__(
828 self,
829 http,
830 postproc,
831 uri,
832 method="GET",
833 body=None,
834 headers=None,
835 methodId=None,
836 resumable=None,
837 ):
838 """Constructor for an HttpRequest.
839
840 Args:
841 http: httplib2.Http, the transport object to use to make a request
842 postproc: callable, called on the HTTP response and content to transform
843 it into a data object before returning, or raising an exception
844 on an error.
845 uri: string, the absolute URI to send the request to
846 method: string, the HTTP method to use
847 body: string, the request body of the HTTP request,
848 headers: dict, the HTTP request headers
849 methodId: string, a unique identifier for the API method being called.
850 resumable: MediaUpload, None if this is not a resumbale request.
851 """
852 self.uri = uri
853 self.method = method
854 self.body = body
855 self.headers = headers or {}
856 self.methodId = methodId
857 self.http = http
858 self.postproc = postproc
859 self.resumable = resumable
860 self.response_callbacks = []
861 self._in_error_state = False
862
863 # The size of the non-media part of the request.
864 self.body_size = len(self.body or "")
865
866 # The resumable URI to send chunks to.
867 self.resumable_uri = None
868
869 # The bytes that have been uploaded.
870 self.resumable_progress = 0
871
872 # Stubs for testing.
873 self._rand = random.random
874 self._sleep = time.sleep
875
876 @util.positional(1)
877 def execute(self, http=None, num_retries=0):
878 """Execute the request.
879
880 Args:

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…