Skip to content

Commit 6f92514

Browse files
asottile-sentryChristinarlong
authored andcommitted
ref: copy signature of _request to plugin api client (#74899)
pretty annoying to need to copy the `overload` -- I'll be following up to remove the overload entirely since that union is mighty annoying everywhere! <!-- Describe your PR here. -->
1 parent 3b57fc9 commit 6f92514

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

src/sentry_plugins/client.py

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
from sentry.shared_integrations.client import BaseApiClient, BaseInternalApiClient
1+
from __future__ import annotations
2+
3+
from collections.abc import Mapping
4+
from typing import Literal, overload
5+
6+
from requests import PreparedRequest, Response
7+
8+
from sentry.shared_integrations.client.base import BaseApiClient, BaseApiResponseX
9+
from sentry.shared_integrations.client.internal import BaseInternalApiClient
210
from sentry.shared_integrations.exceptions import ApiUnauthorized
311
from sentry.users.services.usersocialauth.service import usersocialauth_service
412

@@ -36,6 +44,44 @@ def bind_auth(self, **kwargs):
3644
kwargs["headers"]["Authorization"] = f"Bearer {token}"
3745
return kwargs
3846

47+
@overload
48+
def _request(
49+
self,
50+
method: str,
51+
path: str,
52+
headers: Mapping[str, str] | None = None,
53+
data: Mapping[str, str] | None = None,
54+
params: Mapping[str, str] | None = None,
55+
auth: tuple[str, str] | str | None = None,
56+
json: bool = True,
57+
allow_text: bool | None = None,
58+
allow_redirects: bool | None = None,
59+
timeout: int | None = None,
60+
ignore_webhook_errors: bool = False,
61+
prepared_request: PreparedRequest | None = None,
62+
raw_response: Literal[True] = ...,
63+
) -> Response:
64+
...
65+
66+
@overload
67+
def _request(
68+
self,
69+
method: str,
70+
path: str,
71+
headers: Mapping[str, str] | None = None,
72+
data: Mapping[str, str] | None = None,
73+
params: Mapping[str, str] | None = None,
74+
auth: str | None = None,
75+
json: bool = True,
76+
allow_text: bool | None = None,
77+
allow_redirects: bool | None = None,
78+
timeout: int | None = None,
79+
ignore_webhook_errors: bool = False,
80+
prepared_request: PreparedRequest | None = None,
81+
raw_response: bool = ...,
82+
) -> BaseApiResponseX:
83+
...
84+
3985
def _request(self, method, path, **kwargs):
4086
headers = kwargs.setdefault("headers", {})
4187
headers.setdefault("Accept", "application/json, application/xml")

0 commit comments

Comments
 (0)