Skip to content

Error Reporting: Docs for HTTPContext incorrect #5168

@foresmac

Description

@foresmac

The documentation for error_reporting.client.HTTPContext gives the wrong parameter names.

>>> from google.cloud import error_reporting
>>> client = error_reporting.Client()
>>> user = 'example@gmail.com'
>>> http_context = HTTPContext(method='GET', url='/', userAgent='test agent',
...                            referrer='example.com', responseStatusCode=500,
...                            remote_ip='1.2.3.4')
>>> try:
>>>     raise NameError
>>> except Exception:
>>>     client.report_exception(http_context=http_context, user=user))

Reading the code, it's clear that the camel-cased names are internally used to match expected JSON keys for the underlying API call, but the actual parameter names are properly snake-cased. Oddly, the docs do show the correct parameter name for remote_ip, but not user_agent or response_status_code.

I couldn't figure out which file to edit to fix, otherwise I would have just submitted a PR.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions