methodsdk 0.0.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- method_security/__init__.py +67 -0
- method_security/client.py +137 -0
- method_security/common/__init__.py +32 -0
- method_security/common/types/__init__.py +32 -0
- method_security/common/types/environment_id.py +3 -0
- method_security/core/__init__.py +103 -0
- method_security/core/api_error.py +23 -0
- method_security/core/client_wrapper.py +74 -0
- method_security/core/datetime_utils.py +28 -0
- method_security/core/file.py +67 -0
- method_security/core/force_multipart.py +18 -0
- method_security/core/http_client.py +543 -0
- method_security/core/http_response.py +55 -0
- method_security/core/jsonable_encoder.py +100 -0
- method_security/core/pydantic_utilities.py +258 -0
- method_security/core/query_encoder.py +58 -0
- method_security/core/remove_none_from_dict.py +11 -0
- method_security/core/request_options.py +35 -0
- method_security/core/serialization.py +276 -0
- method_security/issues/__init__.py +40 -0
- method_security/issues/client.py +107 -0
- method_security/issues/errors/__init__.py +32 -0
- method_security/issues/errors/issue_does_not_exist_error.py +11 -0
- method_security/issues/raw_client.py +118 -0
- method_security/issues/types/__init__.py +42 -0
- method_security/issues/types/issue.py +36 -0
- method_security/issues/types/issue_closed_reason.py +5 -0
- method_security/issues/types/issue_id.py +3 -0
- method_security/issues/types/issue_severity.py +5 -0
- method_security/issues/types/issue_status.py +5 -0
- method_security/objects/__init__.py +32 -0
- method_security/objects/types/__init__.py +32 -0
- method_security/objects/types/object_id.py +3 -0
- method_security/py.typed +0 -0
- method_security/version.py +3 -0
- methodsdk-0.0.3.dist-info/METADATA +182 -0
- methodsdk-0.0.3.dist-info/RECORD +38 -0
- methodsdk-0.0.3.dist-info/WHEEL +4 -0
@@ -0,0 +1,107 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
|
5
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
6
|
+
from ..core.request_options import RequestOptions
|
7
|
+
from .raw_client import AsyncRawIssuesClient, RawIssuesClient
|
8
|
+
from .types.issue import Issue
|
9
|
+
from .types.issue_id import IssueId
|
10
|
+
|
11
|
+
|
12
|
+
class IssuesClient:
|
13
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
14
|
+
self._raw_client = RawIssuesClient(client_wrapper=client_wrapper)
|
15
|
+
|
16
|
+
@property
|
17
|
+
def with_raw_response(self) -> RawIssuesClient:
|
18
|
+
"""
|
19
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
20
|
+
|
21
|
+
Returns
|
22
|
+
-------
|
23
|
+
RawIssuesClient
|
24
|
+
"""
|
25
|
+
return self._raw_client
|
26
|
+
|
27
|
+
def get_issue(self, id: IssueId, *, request_options: typing.Optional[RequestOptions] = None) -> Issue:
|
28
|
+
"""
|
29
|
+
Retrieve an issue from Method using its ID
|
30
|
+
|
31
|
+
Parameters
|
32
|
+
----------
|
33
|
+
id : IssueId
|
34
|
+
|
35
|
+
request_options : typing.Optional[RequestOptions]
|
36
|
+
Request-specific configuration.
|
37
|
+
|
38
|
+
Returns
|
39
|
+
-------
|
40
|
+
Issue
|
41
|
+
|
42
|
+
Examples
|
43
|
+
--------
|
44
|
+
from method_security import MethodSecurityApi
|
45
|
+
|
46
|
+
client = MethodSecurityApi(
|
47
|
+
base_url="https://yourhost.com/path/to/api",
|
48
|
+
)
|
49
|
+
client.issues.get_issue(
|
50
|
+
id="ri.method.ontology.issue.8c99d39e-4b5f-331c-8119-7d177fb4f498",
|
51
|
+
)
|
52
|
+
"""
|
53
|
+
_response = self._raw_client.get_issue(id, request_options=request_options)
|
54
|
+
return _response.data
|
55
|
+
|
56
|
+
|
57
|
+
class AsyncIssuesClient:
|
58
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
59
|
+
self._raw_client = AsyncRawIssuesClient(client_wrapper=client_wrapper)
|
60
|
+
|
61
|
+
@property
|
62
|
+
def with_raw_response(self) -> AsyncRawIssuesClient:
|
63
|
+
"""
|
64
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
65
|
+
|
66
|
+
Returns
|
67
|
+
-------
|
68
|
+
AsyncRawIssuesClient
|
69
|
+
"""
|
70
|
+
return self._raw_client
|
71
|
+
|
72
|
+
async def get_issue(self, id: IssueId, *, request_options: typing.Optional[RequestOptions] = None) -> Issue:
|
73
|
+
"""
|
74
|
+
Retrieve an issue from Method using its ID
|
75
|
+
|
76
|
+
Parameters
|
77
|
+
----------
|
78
|
+
id : IssueId
|
79
|
+
|
80
|
+
request_options : typing.Optional[RequestOptions]
|
81
|
+
Request-specific configuration.
|
82
|
+
|
83
|
+
Returns
|
84
|
+
-------
|
85
|
+
Issue
|
86
|
+
|
87
|
+
Examples
|
88
|
+
--------
|
89
|
+
import asyncio
|
90
|
+
|
91
|
+
from method_security import AsyncMethodSecurityApi
|
92
|
+
|
93
|
+
client = AsyncMethodSecurityApi(
|
94
|
+
base_url="https://yourhost.com/path/to/api",
|
95
|
+
)
|
96
|
+
|
97
|
+
|
98
|
+
async def main() -> None:
|
99
|
+
await client.issues.get_issue(
|
100
|
+
id="ri.method.ontology.issue.8c99d39e-4b5f-331c-8119-7d177fb4f498",
|
101
|
+
)
|
102
|
+
|
103
|
+
|
104
|
+
asyncio.run(main())
|
105
|
+
"""
|
106
|
+
_response = await self._raw_client.get_issue(id, request_options=request_options)
|
107
|
+
return _response.data
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
# isort: skip_file
|
4
|
+
|
5
|
+
import typing
|
6
|
+
from importlib import import_module
|
7
|
+
|
8
|
+
if typing.TYPE_CHECKING:
|
9
|
+
from .issue_does_not_exist_error import IssueDoesNotExistError
|
10
|
+
_dynamic_imports: typing.Dict[str, str] = {"IssueDoesNotExistError": ".issue_does_not_exist_error"}
|
11
|
+
|
12
|
+
|
13
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
14
|
+
module_name = _dynamic_imports.get(attr_name)
|
15
|
+
if module_name is None:
|
16
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
17
|
+
try:
|
18
|
+
module = import_module(module_name, __package__)
|
19
|
+
result = getattr(module, attr_name)
|
20
|
+
return result
|
21
|
+
except ImportError as e:
|
22
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
23
|
+
except AttributeError as e:
|
24
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
25
|
+
|
26
|
+
|
27
|
+
def __dir__():
|
28
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
29
|
+
return sorted(lazy_attrs)
|
30
|
+
|
31
|
+
|
32
|
+
__all__ = ["IssueDoesNotExistError"]
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
|
5
|
+
from ...core.api_error import ApiError
|
6
|
+
from ..types.issue_id import IssueId
|
7
|
+
|
8
|
+
|
9
|
+
class IssueDoesNotExistError(ApiError):
|
10
|
+
def __init__(self, body: IssueId, headers: typing.Optional[typing.Dict[str, str]] = None):
|
11
|
+
super().__init__(status_code=404, headers=headers, body=body)
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
from json.decoder import JSONDecodeError
|
5
|
+
|
6
|
+
from ..core.api_error import ApiError
|
7
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
8
|
+
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
9
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
10
|
+
from ..core.pydantic_utilities import parse_obj_as
|
11
|
+
from ..core.request_options import RequestOptions
|
12
|
+
from .errors.issue_does_not_exist_error import IssueDoesNotExistError
|
13
|
+
from .types.issue import Issue
|
14
|
+
from .types.issue_id import IssueId
|
15
|
+
|
16
|
+
|
17
|
+
class RawIssuesClient:
|
18
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
19
|
+
self._client_wrapper = client_wrapper
|
20
|
+
|
21
|
+
def get_issue(self, id: IssueId, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Issue]:
|
22
|
+
"""
|
23
|
+
Retrieve an issue from Method using its ID
|
24
|
+
|
25
|
+
Parameters
|
26
|
+
----------
|
27
|
+
id : IssueId
|
28
|
+
|
29
|
+
request_options : typing.Optional[RequestOptions]
|
30
|
+
Request-specific configuration.
|
31
|
+
|
32
|
+
Returns
|
33
|
+
-------
|
34
|
+
HttpResponse[Issue]
|
35
|
+
"""
|
36
|
+
_response = self._client_wrapper.httpx_client.request(
|
37
|
+
f"issues/{jsonable_encoder(id)}",
|
38
|
+
method="GET",
|
39
|
+
request_options=request_options,
|
40
|
+
)
|
41
|
+
try:
|
42
|
+
if 200 <= _response.status_code < 300:
|
43
|
+
_data = typing.cast(
|
44
|
+
Issue,
|
45
|
+
parse_obj_as(
|
46
|
+
type_=Issue, # type: ignore
|
47
|
+
object_=_response.json(),
|
48
|
+
),
|
49
|
+
)
|
50
|
+
return HttpResponse(response=_response, data=_data)
|
51
|
+
if _response.status_code == 404:
|
52
|
+
raise IssueDoesNotExistError(
|
53
|
+
headers=dict(_response.headers),
|
54
|
+
body=typing.cast(
|
55
|
+
IssueId,
|
56
|
+
parse_obj_as(
|
57
|
+
type_=IssueId, # type: ignore
|
58
|
+
object_=_response.json(),
|
59
|
+
),
|
60
|
+
),
|
61
|
+
)
|
62
|
+
_response_json = _response.json()
|
63
|
+
except JSONDecodeError:
|
64
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
65
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
66
|
+
|
67
|
+
|
68
|
+
class AsyncRawIssuesClient:
|
69
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
70
|
+
self._client_wrapper = client_wrapper
|
71
|
+
|
72
|
+
async def get_issue(
|
73
|
+
self, id: IssueId, *, request_options: typing.Optional[RequestOptions] = None
|
74
|
+
) -> AsyncHttpResponse[Issue]:
|
75
|
+
"""
|
76
|
+
Retrieve an issue from Method using its ID
|
77
|
+
|
78
|
+
Parameters
|
79
|
+
----------
|
80
|
+
id : IssueId
|
81
|
+
|
82
|
+
request_options : typing.Optional[RequestOptions]
|
83
|
+
Request-specific configuration.
|
84
|
+
|
85
|
+
Returns
|
86
|
+
-------
|
87
|
+
AsyncHttpResponse[Issue]
|
88
|
+
"""
|
89
|
+
_response = await self._client_wrapper.httpx_client.request(
|
90
|
+
f"issues/{jsonable_encoder(id)}",
|
91
|
+
method="GET",
|
92
|
+
request_options=request_options,
|
93
|
+
)
|
94
|
+
try:
|
95
|
+
if 200 <= _response.status_code < 300:
|
96
|
+
_data = typing.cast(
|
97
|
+
Issue,
|
98
|
+
parse_obj_as(
|
99
|
+
type_=Issue, # type: ignore
|
100
|
+
object_=_response.json(),
|
101
|
+
),
|
102
|
+
)
|
103
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
104
|
+
if _response.status_code == 404:
|
105
|
+
raise IssueDoesNotExistError(
|
106
|
+
headers=dict(_response.headers),
|
107
|
+
body=typing.cast(
|
108
|
+
IssueId,
|
109
|
+
parse_obj_as(
|
110
|
+
type_=IssueId, # type: ignore
|
111
|
+
object_=_response.json(),
|
112
|
+
),
|
113
|
+
),
|
114
|
+
)
|
115
|
+
_response_json = _response.json()
|
116
|
+
except JSONDecodeError:
|
117
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
118
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
# isort: skip_file
|
4
|
+
|
5
|
+
import typing
|
6
|
+
from importlib import import_module
|
7
|
+
|
8
|
+
if typing.TYPE_CHECKING:
|
9
|
+
from .issue import Issue
|
10
|
+
from .issue_closed_reason import IssueClosedReason
|
11
|
+
from .issue_id import IssueId
|
12
|
+
from .issue_severity import IssueSeverity
|
13
|
+
from .issue_status import IssueStatus
|
14
|
+
_dynamic_imports: typing.Dict[str, str] = {
|
15
|
+
"Issue": ".issue",
|
16
|
+
"IssueClosedReason": ".issue_closed_reason",
|
17
|
+
"IssueId": ".issue_id",
|
18
|
+
"IssueSeverity": ".issue_severity",
|
19
|
+
"IssueStatus": ".issue_status",
|
20
|
+
}
|
21
|
+
|
22
|
+
|
23
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
24
|
+
module_name = _dynamic_imports.get(attr_name)
|
25
|
+
if module_name is None:
|
26
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
27
|
+
try:
|
28
|
+
module = import_module(module_name, __package__)
|
29
|
+
result = getattr(module, attr_name)
|
30
|
+
return result
|
31
|
+
except ImportError as e:
|
32
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
33
|
+
except AttributeError as e:
|
34
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
35
|
+
|
36
|
+
|
37
|
+
def __dir__():
|
38
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
39
|
+
return sorted(lazy_attrs)
|
40
|
+
|
41
|
+
|
42
|
+
__all__ = ["Issue", "IssueClosedReason", "IssueId", "IssueSeverity", "IssueStatus"]
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
|
5
|
+
import pydantic
|
6
|
+
import typing_extensions
|
7
|
+
from ...common.types.environment_id import EnvironmentId
|
8
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
9
|
+
from ...core.serialization import FieldMetadata
|
10
|
+
from ...objects.types.object_id import ObjectId
|
11
|
+
from .issue_closed_reason import IssueClosedReason
|
12
|
+
from .issue_id import IssueId
|
13
|
+
from .issue_severity import IssueSeverity
|
14
|
+
from .issue_status import IssueStatus
|
15
|
+
|
16
|
+
|
17
|
+
class Issue(UniversalBaseModel):
|
18
|
+
id: IssueId
|
19
|
+
environment_id: typing_extensions.Annotated[EnvironmentId, FieldMetadata(alias="environmentId")]
|
20
|
+
description: str
|
21
|
+
status: IssueStatus
|
22
|
+
severity: IssueSeverity
|
23
|
+
closed_reason: typing_extensions.Annotated[
|
24
|
+
typing.Optional[IssueClosedReason], FieldMetadata(alias="closedReason")
|
25
|
+
] = None
|
26
|
+
affected_object_id: typing_extensions.Annotated[ObjectId, FieldMetadata(alias="affectedObjectId")]
|
27
|
+
affected_object_title: typing_extensions.Annotated[str, FieldMetadata(alias="affectedObjectTitle")]
|
28
|
+
|
29
|
+
if IS_PYDANTIC_V2:
|
30
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
31
|
+
else:
|
32
|
+
|
33
|
+
class Config:
|
34
|
+
frozen = True
|
35
|
+
smart_union = True
|
36
|
+
extra = pydantic.Extra.allow
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
# isort: skip_file
|
4
|
+
|
5
|
+
import typing
|
6
|
+
from importlib import import_module
|
7
|
+
|
8
|
+
if typing.TYPE_CHECKING:
|
9
|
+
from .types import ObjectId
|
10
|
+
_dynamic_imports: typing.Dict[str, str] = {"ObjectId": ".types"}
|
11
|
+
|
12
|
+
|
13
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
14
|
+
module_name = _dynamic_imports.get(attr_name)
|
15
|
+
if module_name is None:
|
16
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
17
|
+
try:
|
18
|
+
module = import_module(module_name, __package__)
|
19
|
+
result = getattr(module, attr_name)
|
20
|
+
return result
|
21
|
+
except ImportError as e:
|
22
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
23
|
+
except AttributeError as e:
|
24
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
25
|
+
|
26
|
+
|
27
|
+
def __dir__():
|
28
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
29
|
+
return sorted(lazy_attrs)
|
30
|
+
|
31
|
+
|
32
|
+
__all__ = ["ObjectId"]
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
# isort: skip_file
|
4
|
+
|
5
|
+
import typing
|
6
|
+
from importlib import import_module
|
7
|
+
|
8
|
+
if typing.TYPE_CHECKING:
|
9
|
+
from .object_id import ObjectId
|
10
|
+
_dynamic_imports: typing.Dict[str, str] = {"ObjectId": ".object_id"}
|
11
|
+
|
12
|
+
|
13
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
14
|
+
module_name = _dynamic_imports.get(attr_name)
|
15
|
+
if module_name is None:
|
16
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
17
|
+
try:
|
18
|
+
module = import_module(module_name, __package__)
|
19
|
+
result = getattr(module, attr_name)
|
20
|
+
return result
|
21
|
+
except ImportError as e:
|
22
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
23
|
+
except AttributeError as e:
|
24
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
25
|
+
|
26
|
+
|
27
|
+
def __dir__():
|
28
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
29
|
+
return sorted(lazy_attrs)
|
30
|
+
|
31
|
+
|
32
|
+
__all__ = ["ObjectId"]
|
method_security/py.typed
ADDED
File without changes
|
@@ -0,0 +1,182 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: methodsdk
|
3
|
+
Version: 0.0.3
|
4
|
+
Summary:
|
5
|
+
Requires-Python: >=3.8,<4.0
|
6
|
+
Classifier: Intended Audience :: Developers
|
7
|
+
Classifier: Operating System :: MacOS
|
8
|
+
Classifier: Operating System :: Microsoft :: Windows
|
9
|
+
Classifier: Operating System :: OS Independent
|
10
|
+
Classifier: Operating System :: POSIX
|
11
|
+
Classifier: Operating System :: POSIX :: Linux
|
12
|
+
Classifier: Programming Language :: Python
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
20
|
+
Classifier: Typing :: Typed
|
21
|
+
Requires-Dist: httpx (>=0.21.2)
|
22
|
+
Requires-Dist: pydantic (>=1.9.2)
|
23
|
+
Requires-Dist: pydantic-core (>=2.18.2)
|
24
|
+
Requires-Dist: typing_extensions (>=4.0.0)
|
25
|
+
Description-Content-Type: text/markdown
|
26
|
+
|
27
|
+
# MethodSecurity Python Library
|
28
|
+
|
29
|
+
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fmethod-security%2Fmethod-python-sdk)
|
30
|
+
[](https://pypi.python.org/pypi/methodsdk)
|
31
|
+
|
32
|
+
The MethodSecurity Python library provides convenient access to the MethodSecurity APIs from Python.
|
33
|
+
|
34
|
+
## Installation
|
35
|
+
|
36
|
+
```sh
|
37
|
+
pip install methodsdk
|
38
|
+
```
|
39
|
+
|
40
|
+
## Reference
|
41
|
+
|
42
|
+
A full reference for this library is available [here](https://github.com/method-security/method-python-sdk/blob/HEAD/./reference.md).
|
43
|
+
|
44
|
+
## Usage
|
45
|
+
|
46
|
+
Instantiate and use the client with the following:
|
47
|
+
|
48
|
+
```python
|
49
|
+
from method_security import MethodSecurityApi
|
50
|
+
|
51
|
+
client = MethodSecurityApi(
|
52
|
+
base_url="https://yourhost.com/path/to/api",
|
53
|
+
)
|
54
|
+
client.issues.get_issue(
|
55
|
+
id="ri.method.ontology.issue.8c99d39e-4b5f-331c-8119-7d177fb4f498",
|
56
|
+
)
|
57
|
+
```
|
58
|
+
|
59
|
+
## Async Client
|
60
|
+
|
61
|
+
The SDK also exports an `async` client so that you can make non-blocking calls to our API.
|
62
|
+
|
63
|
+
```python
|
64
|
+
import asyncio
|
65
|
+
|
66
|
+
from method_security import AsyncMethodSecurityApi
|
67
|
+
|
68
|
+
client = AsyncMethodSecurityApi(
|
69
|
+
base_url="https://yourhost.com/path/to/api",
|
70
|
+
)
|
71
|
+
|
72
|
+
|
73
|
+
async def main() -> None:
|
74
|
+
await client.issues.get_issue(
|
75
|
+
id="ri.method.ontology.issue.8c99d39e-4b5f-331c-8119-7d177fb4f498",
|
76
|
+
)
|
77
|
+
|
78
|
+
|
79
|
+
asyncio.run(main())
|
80
|
+
```
|
81
|
+
|
82
|
+
## Exception Handling
|
83
|
+
|
84
|
+
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
|
85
|
+
will be thrown.
|
86
|
+
|
87
|
+
```python
|
88
|
+
from method_security.core.api_error import ApiError
|
89
|
+
|
90
|
+
try:
|
91
|
+
client.issues.get_issue()
|
92
|
+
except ApiError as e:
|
93
|
+
print(e.status_code)
|
94
|
+
print(e.body)
|
95
|
+
```
|
96
|
+
|
97
|
+
## Advanced
|
98
|
+
|
99
|
+
### Access Raw Response Data
|
100
|
+
|
101
|
+
The SDK provides access to raw response data, including headers, through the `.with_raw_response` property.
|
102
|
+
The `.with_raw_response` property returns a "raw" client that can be used to access the `.headers` and `.data` attributes.
|
103
|
+
|
104
|
+
```python
|
105
|
+
from method_security import MethodSecurityApi
|
106
|
+
|
107
|
+
client = MethodSecurityApi(
|
108
|
+
...,
|
109
|
+
)
|
110
|
+
response = client.issues.with_raw_response.get_issue()
|
111
|
+
print(response.headers) # access the response headers
|
112
|
+
print(response.data) # access the underlying object
|
113
|
+
```
|
114
|
+
|
115
|
+
### Retries
|
116
|
+
|
117
|
+
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
|
118
|
+
as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
|
119
|
+
retry limit (default: 2).
|
120
|
+
|
121
|
+
A request is deemed retryable when any of the following HTTP status codes is returned:
|
122
|
+
|
123
|
+
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
|
124
|
+
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
|
125
|
+
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
|
126
|
+
|
127
|
+
Use the `max_retries` request option to configure this behavior.
|
128
|
+
|
129
|
+
```python
|
130
|
+
client.issues.get_issue(request_options={
|
131
|
+
"max_retries": 1
|
132
|
+
})
|
133
|
+
```
|
134
|
+
|
135
|
+
### Timeouts
|
136
|
+
|
137
|
+
The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
|
138
|
+
|
139
|
+
```python
|
140
|
+
|
141
|
+
from method_security import MethodSecurityApi
|
142
|
+
|
143
|
+
client = MethodSecurityApi(
|
144
|
+
...,
|
145
|
+
timeout=20.0,
|
146
|
+
)
|
147
|
+
|
148
|
+
|
149
|
+
# Override timeout for a specific method
|
150
|
+
client.issues.get_issue(request_options={
|
151
|
+
"timeout_in_seconds": 1
|
152
|
+
})
|
153
|
+
```
|
154
|
+
|
155
|
+
### Custom Client
|
156
|
+
|
157
|
+
You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
|
158
|
+
and transports.
|
159
|
+
|
160
|
+
```python
|
161
|
+
import httpx
|
162
|
+
from method_security import MethodSecurityApi
|
163
|
+
|
164
|
+
client = MethodSecurityApi(
|
165
|
+
...,
|
166
|
+
httpx_client=httpx.Client(
|
167
|
+
proxies="http://my.test.proxy.example.com",
|
168
|
+
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
|
169
|
+
),
|
170
|
+
)
|
171
|
+
```
|
172
|
+
|
173
|
+
## Contributing
|
174
|
+
|
175
|
+
While we value open-source contributions to this SDK, this library is generated programmatically.
|
176
|
+
Additions made directly to this library would have to be moved over to our generation code,
|
177
|
+
otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
|
178
|
+
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
|
179
|
+
an issue first to discuss with us!
|
180
|
+
|
181
|
+
On the other hand, contributions to the README are always very welcome!
|
182
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
method_security/__init__.py,sha256=AOD5vMc55opE3103X8GMj53ga7-7ryT4lCWAJfVEuzc,1940
|
2
|
+
method_security/client.py,sha256=0M_5gTr0Le14DPtjk8rOeylPpuPbjocTOcwf9oQ_1H4,5156
|
3
|
+
method_security/common/__init__.py,sha256=PIZFn7O33jJ8d5gotcFDUB0Jfa0cr5IbU1PMvdxHWEQ,996
|
4
|
+
method_security/common/types/__init__.py,sha256=VcZmN-hKZp8sITvG--3RIT2TPvu3eXArM7JVIUjDsTA,1014
|
5
|
+
method_security/common/types/environment_id.py,sha256=rTVX5tfhkyuShEgOeFNdXNLYd2xFcifdp6bjc_AZh-4,85
|
6
|
+
method_security/core/__init__.py,sha256=JEuWUBvwpp2bG8dysycjfsGZW5A7U1iFuTUdKCYBe18,3561
|
7
|
+
method_security/core/api_error.py,sha256=44vPoTyWN59gonCIZMdzw7M1uspygiLnr3GNFOoVL2Q,614
|
8
|
+
method_security/core/client_wrapper.py,sha256=HEpTRbmE6llqcDzveNbQN6s0QTm73gQ2NrnnzjQy57c,2193
|
9
|
+
method_security/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
|
10
|
+
method_security/core/file.py,sha256=d4NNbX8XvXP32z8KpK2Xovv33nFfruIrpz0QWxlgpZk,2663
|
11
|
+
method_security/core/force_multipart.py,sha256=cH981xLy0kZVKiZZkFoeUjgJ2Zuq7KXB2aRAnmHzRDc,477
|
12
|
+
method_security/core/http_client.py,sha256=QurkBvCZZz2Z1d8znp4M2YbOXebBUPcPXRhPIS84Wvk,21214
|
13
|
+
method_security/core/http_response.py,sha256=A6URkoTBCiryctAA-m9EiDWOsHgM5oYAlcYVc_YOiiI,1330
|
14
|
+
method_security/core/jsonable_encoder.py,sha256=hGgcEEeX11sqxxsll7h15pO3pTNVxk_n79Kcn0laoWA,3655
|
15
|
+
method_security/core/pydantic_utilities.py,sha256=alHZbJORJ1RxtFlr4Aohw47_QAtCeMbcGPgCvxKsfPM,10830
|
16
|
+
method_security/core/query_encoder.py,sha256=ekulqNd0j8TgD7ox-Qbz7liqX8-KP9blvT9DsRCenYM,2144
|
17
|
+
method_security/core/remove_none_from_dict.py,sha256=EU9SGgYidWq7SexuJbNs4-PZ-5Bl3Vppd864mS6vQZw,342
|
18
|
+
method_security/core/request_options.py,sha256=h0QUNCFVdCW_7GclVySCAY2w4NhtXVBUCmHgmzaxpcg,1681
|
19
|
+
method_security/core/serialization.py,sha256=ECL3bvv_0i7U4uvPidZCNel--MUbA0iq0aGcNKi3kws,9818
|
20
|
+
method_security/issues/__init__.py,sha256=dxu6m_AgSfueonv3pZEooW0IStxVtTwM2SQq020d0g8,1333
|
21
|
+
method_security/issues/client.py,sha256=jjtpHvufJmMTWyaaTCWTtwFWeV79acxvvB7OnJGIZmU,2968
|
22
|
+
method_security/issues/errors/__init__.py,sha256=8EWUlufeGM4jiCck5oNhzpyykjUHUAFf36OV7ap1yK4,1065
|
23
|
+
method_security/issues/errors/issue_does_not_exist_error.py,sha256=M36fSibrza_M2s6zFy3USbKD7oiZvYu5qNy2hI5RWbE,363
|
24
|
+
method_security/issues/raw_client.py,sha256=nGtOdhWKP-1LxRRvkzTRBxXaRNibH5ffTU4fDSSfUJI,4350
|
25
|
+
method_security/issues/types/__init__.py,sha256=TwfAAd4MxR5WUgGCgwKT1h-0g3cq1Hx34FVpSCKL2Cg,1373
|
26
|
+
method_security/issues/types/issue.py,sha256=gZovOd2Tpp4ExtxGUZmb6WIf6dgD1_PEL-jcf2geTJY,1376
|
27
|
+
method_security/issues/types/issue_closed_reason.py,sha256=Tl9eImL2BEMcCHdeyHDPxDwaD1VtZUZ9tIcQBBpd9wk,188
|
28
|
+
method_security/issues/types/issue_id.py,sha256=N1uUYI8M-WQIPBHdrHg2rsVytdkOIAUg5fCMpV8wP88,79
|
29
|
+
method_security/issues/types/issue_severity.py,sha256=m1JsRGhkNhFaQzbNxKjO0_aOp9D7GH9t5kFAyu66wWE,182
|
30
|
+
method_security/issues/types/issue_status.py,sha256=HkLrABe4DoCBTulu2h5ZprR9re1TQAjZnUTqDf2osYk,165
|
31
|
+
method_security/objects/__init__.py,sha256=tVFO2TVA0LcqunPWH5JCVOKsFpRMLFPc1jjgOZ5x1kI,981
|
32
|
+
method_security/objects/types/__init__.py,sha256=jlVLwR0gVExvWY_8aX8lkCj2yCg1h8gmt6lP2UIu6t0,989
|
33
|
+
method_security/objects/types/object_id.py,sha256=qM0JqAh4F93p99NmwrlCDFWrz_IirFcHrJsrX5XvvM8,80
|
34
|
+
method_security/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
|
+
method_security/version.py,sha256=UtvKA1fp_ZsNGUtAHi8_yoFObAUaWBXYSPiKhoyD_68,76
|
36
|
+
methodsdk-0.0.3.dist-info/METADATA,sha256=81jcoL5Y1dnzHEc3R1YqSAaOwpvLNBlpyewTMKAntUQ,5318
|
37
|
+
methodsdk-0.0.3.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
38
|
+
methodsdk-0.0.3.dist-info/RECORD,,
|