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

Function _fix_up_parameters

googleapiclient/discovery.py:813–854  ·  view source on GitHub ↗

Updates parameters of an API method with values specific to this library. Specifically, adds whatever global parameters are specified by the API to the parameters for the individual method. Also adds parameters which don't appear in the discovery document, but are available to all disco

(method_desc, root_desc, http_method, schema)

Source from the content-addressed store, hash-verified

811
812
813def _fix_up_parameters(method_desc, root_desc, http_method, schema):
814 """Updates parameters of an API method with values specific to this library.
815
816 Specifically, adds whatever global parameters are specified by the API to the
817 parameters for the individual method. Also adds parameters which don't
818 appear in the discovery document, but are available to all discovery based
819 APIs (these are listed in STACK_QUERY_PARAMETERS).
820
821 SIDE EFFECTS: This updates the parameters dictionary object in the method
822 description.
823
824 Args:
825 method_desc: Dictionary with metadata describing an API method. Value comes
826 from the dictionary of methods stored in the 'methods' key in the
827 deserialized discovery document.
828 root_desc: Dictionary; the entire original deserialized discovery document.
829 http_method: String; the HTTP method used to call the API method described
830 in method_desc.
831 schema: Object, mapping of schema names to schema descriptions.
832
833 Returns:
834 The updated Dictionary stored in the 'parameters' key of the method
835 description dictionary.
836 """
837 parameters = method_desc.setdefault("parameters", {})
838
839 # Add in the parameters common to all methods.
840 for name, description in root_desc.get("parameters", {}).items():
841 parameters[name] = description
842
843 # Add in undocumented query parameters.
844 for name in STACK_QUERY_PARAMETERS:
845 parameters[name] = STACK_QUERY_PARAMETER_DEFAULT_VALUE.copy()
846
847 # Add 'body' (our own reserved word) to parameters if the method supports
848 # a request payload.
849 if http_method in HTTP_PAYLOAD_METHODS and "request" in method_desc:
850 body = BODY_PARAMETER_DEFAULT_VALUE.copy()
851 body.update(method_desc["request"])
852 parameters["body"] = body
853
854 return parameters
855
856
857def _fix_up_media_upload(method_desc, root_desc, path_url, parameters):

Calls 2

updateMethod · 0.80
getMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…