Error Reporting client. Currently Error Reporting is done by creating
a Logging client.
Parameters
project(str) – the project which the client acts on behalf of. If not
passed falls back to the default inferred from the
environment.
credentials(google.auth.credentials.CredentialsorNoneType) – The authorization credentials to attach to requests.
These credentials identify this application to the service.
If none are specified, the client will attempt to ascertain
the credentials from the environment.
_http(Session) – (Optional) HTTP object to make requests. Can be any object
that definesrequest()with the same interface asrequests.Session.request(). If not passed, an_httpobject is created that is bound to thecredentialsfor the current object.
This parameter should be considered private, and could
change in the future.
service(str) – An identifier of the service, such as the name of the
executable, job, or Google App Engine service name. This
field is expected to have a low number of values that are
relatively stable over time, as opposed to version,
which can be changed whenever new code is deployed.
version(str) – Represents the source code version that the developer
provided, which could represent a version label or a Git
SHA-1 hash, for example. If the developer did not provide
a version, the value is set to default.
_use_grpc(bool) – (Optional) Explicitly specifies whether
to use the gRPC transport or HTTP. If unset,
falls back to theGOOGLE_CLOUD_DISABLE_GRPCenvironment variable.
This parameter should be considered private, and could
change in the future.
client_options(ClientOptionsordict) – (Optional) Client options used to set user options
on the client. API Endpoint should be set through client_options.
Raises
ValueErrorif the project is neither passed in nor
set in the environment.
http_context(:class`google.cloud.error_reporting.HTTPContext`) – The HTTP request which was processed when the
error was triggered.
user(str) – The user who caused or was affected by the crash. This
can be a user ID, an email address, or an arbitrary
token that uniquely identifies the user. When sending
an error report, leave this field empty if the user
was not logged in. In this case the Error Reporting
system will use other data, such as remote IP address,
to distinguish affected users.
Reports the details of the latest exceptions to Error Reporting.
Parameters
http_context(:class`google.cloud.error_reporting.HTTPContext`) – The HTTP request which was processed when the
error was triggered.
user(str) – The user who caused or was affected by the crash. This
can be a user ID, an email address, or an arbitrary
token that uniquely identifies the user. When sending an
error report, leave this field empty if the user was
not logged in. In this case the Error Reporting system
will use other data, such as remote IP address,
to distinguish affected users.
user_agent(str) – The user agent information that is provided with the
request.
referrer(str) – The referrer information that is provided with the
request.
response_status_code(int) – The HTTP response status code for the request.
remote_ip(str) – The IP address from which the request originated. This
can be IPv4, IPv6, or a token which is derived from
the IP address, depending on the data that has been
provided in the error report.
[[["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-09-04 UTC."],[],[],null,["Version latestkeyboard_arrow_down\n\n- [1.12.0 (latest)](/python/docs/reference/clouderrorreporting/latest/client)\n- [1.11.1](/python/docs/reference/clouderrorreporting/1.11.1/client)\n- [1.10.0](/python/docs/reference/clouderrorreporting/1.10.0/client)\n- [1.9.2](/python/docs/reference/clouderrorreporting/1.9.2/client)\n- [1.8.2](/python/docs/reference/clouderrorreporting/1.8.2/client)\n- [1.7.0](/python/docs/reference/clouderrorreporting/1.7.0/client)\n- [1.6.3](/python/docs/reference/clouderrorreporting/1.6.3/client)\n- [1.5.3](/python/docs/reference/clouderrorreporting/1.5.3/client)\n- [1.4.1](/python/docs/reference/clouderrorreporting/1.4.1/client)\n- [1.3.0](/python/docs/reference/clouderrorreporting/1.3.0/client)\n- [1.2.3](/python/docs/reference/clouderrorreporting/1.2.3/client)\n- [1.1.2](/python/docs/reference/clouderrorreporting/1.1.2/client)\n- [1.0.0](/python/docs/reference/clouderrorreporting/1.0.0/client)\n- [0.34.0](/python/docs/reference/clouderrorreporting/0.34.0/client)\n- [0.33.0](/python/docs/reference/clouderrorreporting/0.33.0/client)\n- [0.32.1](/python/docs/reference/clouderrorreporting/0.32.1/client) \n\nError Reporting Client\n======================\n\nClient for interacting with the Error Reporting API\n\n### *class* google.cloud.error_reporting.client.Client(project=None, credentials=None, _http=None, service=None, version=None, client_info=\\\u003cgoogle.api_core.gapic_v1.client_info.ClientInfo object\\\u003e, client_options=None, _use_grpc=None)\n\nBases: `google.cloud.client.ClientWithProject`\n\nError Reporting client. Currently Error Reporting is done by creating\na Logging client.\n\n- **Parameters**\n\n - **project** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) -- the project which the client acts on behalf of. If not\n passed falls back to the default inferred from the\n environment.\n\n - **credentials** ([`google.auth.credentials.Credentials`](https://googleapis.dev/python/google-auth/latest/reference/google.auth.credentials.html#google.auth.credentials.Credentials) or\n `NoneType`) -- The authorization credentials to attach to requests.\n These credentials identify this application to the service.\n If none are specified, the client will attempt to ascertain\n the credentials from the environment.\n\n - **_http** (`Session`) -- (Optional) HTTP object to make requests. Can be any object\n that defines `request()` with the same interface as\n `requests.Session.request()`. If not passed, an\n `_http` object is created that is bound to the\n `credentials` for the current object.\n This parameter should be considered private, and could\n change in the future.\n\n - **service** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) -- An identifier of the service, such as the name of the\n executable, job, or Google App Engine service name. This\n field is expected to have a low number of values that are\n relatively stable over time, as opposed to version,\n which can be changed whenever new code is deployed.\n\n - **version** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) -- Represents the source code version that the developer\n provided, which could represent a version label or a Git\n SHA-1 hash, for example. If the developer did not provide\n a version, the value is set to default.\n\n - **_use_grpc** ([*bool*](https://docs.python.org/3/library/functions.html#bool)) -- (Optional) Explicitly specifies whether\n to use the gRPC transport or HTTP. If unset,\n falls back to the `GOOGLE_CLOUD_DISABLE_GRPC`\n environment variable.\n This parameter should be considered private, and could\n change in the future.\n\n - **client_info** ([`google.api_core.client_info.ClientInfo`](https://googleapis.dev/python/google-api-core/latest/client_info.html#google.api_core.client_info.ClientInfo) or\n [`google.api_core.gapic_v1.client_info.ClientInfo`](https://googleapis.dev/python/google-api-core/latest/client_info.html#google.api_core.gapic_v1.client_info.ClientInfo)) -- The client info used to send a user-agent string along with API\n requests. If `None`, then default info will be used. Generally,\n you only need to set this if you're developing your own library\n or partner tool.\n\n - **client_options** ([`ClientOptions`](https://googleapis.dev/python/google-api-core/latest/client_options.html#google.api_core.client_options.ClientOptions)\n or [`dict`](https://docs.python.org/3/library/stdtypes.html#dict)) -- (Optional) Client options used to set user options\n on the client. API Endpoint should be set through client_options.\n\n- **Raises**\n\n [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) if the project is neither passed in nor\n set in the environment.\n\n#### SCOPE(*: Union\\[Tuple\\[[str](https://docs.python.org/3/library/stdtypes.html#str), ...\\], [None](https://docs.python.org/3/library/constants.html#None)* *= ('\u003chttps://www.googleapis.com/auth/cloud-platform\u003e',* )\n\nThe scopes required for authenticating as an API consumer.\n\n#### report(message, http_context=None, user=None)\n\nReports a message to Error Reporting\n\n\u003chttps://cloud.google.com/error-reporting/docs/formatting-error-messages\u003e\n\n- **Parameters**\n\n - **message** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) -- A user-supplied message to report\n\n - **http_context** (*:class\\`google.cloud.error_reporting.HTTPContext\\`*) -- The HTTP request which was processed when the\n error was triggered.\n\n - **user** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) -- The user who caused or was affected by the crash. This\n can be a user ID, an email address, or an arbitrary\n token that uniquely identifies the user. When sending\n an error report, leave this field empty if the user\n was not logged in. In this case the Error Reporting\n system will use other data, such as remote IP address,\n to distinguish affected users.\n\nExample: \n\n \u003e\u003e\u003e client.report(\"Something went wrong!\")\n\n#### *property* report_errors_api()\n\nHelper for logging-related API calls.\n\nSee\n\u003chttps://cloud.google.com/logging/docs/reference/v2/rest/v2/entries\u003e\n\u003chttps://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.logs\u003e\n\n- **Return type**\n\n `_gapic._ErrorReportingGapicApi`\n or\n `_logging._ErrorReportingLoggingAPI`\n- **Returns**\n\n A class that implements the report errors API.\n\n#### report_exception(http_context=None, user=None)\n\nReports the details of the latest exceptions to Error Reporting.\n\n- **Parameters**\n\n - **http_context** (*:class\\`google.cloud.error_reporting.HTTPContext\\`*) -- The HTTP request which was processed when the\n error was triggered.\n\n - **user** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) -- The user who caused or was affected by the crash. This\n\n can be a user ID, an email address, or an arbitrary\n token that uniquely identifies the user. When sending an\n error report, leave this field empty if the user was\n not logged in. In this case the Error Reporting system\n will use other data, such as remote IP address,\n to distinguish affected users.\n\n Example: \n\n \u003e\u003e\u003e try:\n \u003e\u003e\u003e raise NameError\n \u003e\u003e\u003e except Exception:\n \u003e\u003e\u003e client.report_exception()\n\n### *class* google.cloud.error_reporting.client.HTTPContext(method=None, url=None, user_agent=None, referrer=None, response_status_code=None, remote_ip=None)\n\nBases: [`object`](https://docs.python.org/3/library/functions.html#object)\n\nHTTPContext defines an object that captures the parameter for the\nhttpRequest part of Error Reporting API\n\n- **Parameters**\n\n - **method** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) -- The type of HTTP request, such as GET, POST, etc.\n\n - **url** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) -- The URL of the request\n\n - **user_agent** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) -- The user agent information that is provided with the\n request.\n\n - **referrer** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) -- The referrer information that is provided with the\n request.\n\n - **response_status_code** ([*int*](https://docs.python.org/3/library/functions.html#int)) -- The HTTP response status code for the request.\n\n - **remote_ip** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) -- The IP address from which the request originated. This\n can be IPv4, IPv6, or a token which is derived from\n the IP address, depending on the data that has been\n provided in the error report."]]