methodsdk 0.0.3__tar.gz
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.
- methodsdk-0.0.3/PKG-INFO +182 -0
- methodsdk-0.0.3/README.md +155 -0
- methodsdk-0.0.3/pyproject.toml +84 -0
- methodsdk-0.0.3/src/method_security/__init__.py +67 -0
- methodsdk-0.0.3/src/method_security/client.py +137 -0
- methodsdk-0.0.3/src/method_security/common/__init__.py +32 -0
- methodsdk-0.0.3/src/method_security/common/types/__init__.py +32 -0
- methodsdk-0.0.3/src/method_security/common/types/environment_id.py +3 -0
- methodsdk-0.0.3/src/method_security/core/__init__.py +103 -0
- methodsdk-0.0.3/src/method_security/core/api_error.py +23 -0
- methodsdk-0.0.3/src/method_security/core/client_wrapper.py +74 -0
- methodsdk-0.0.3/src/method_security/core/datetime_utils.py +28 -0
- methodsdk-0.0.3/src/method_security/core/file.py +67 -0
- methodsdk-0.0.3/src/method_security/core/force_multipart.py +18 -0
- methodsdk-0.0.3/src/method_security/core/http_client.py +543 -0
- methodsdk-0.0.3/src/method_security/core/http_response.py +55 -0
- methodsdk-0.0.3/src/method_security/core/jsonable_encoder.py +100 -0
- methodsdk-0.0.3/src/method_security/core/pydantic_utilities.py +258 -0
- methodsdk-0.0.3/src/method_security/core/query_encoder.py +58 -0
- methodsdk-0.0.3/src/method_security/core/remove_none_from_dict.py +11 -0
- methodsdk-0.0.3/src/method_security/core/request_options.py +35 -0
- methodsdk-0.0.3/src/method_security/core/serialization.py +276 -0
- methodsdk-0.0.3/src/method_security/issues/__init__.py +40 -0
- methodsdk-0.0.3/src/method_security/issues/client.py +107 -0
- methodsdk-0.0.3/src/method_security/issues/errors/__init__.py +32 -0
- methodsdk-0.0.3/src/method_security/issues/errors/issue_does_not_exist_error.py +11 -0
- methodsdk-0.0.3/src/method_security/issues/raw_client.py +118 -0
- methodsdk-0.0.3/src/method_security/issues/types/__init__.py +42 -0
- methodsdk-0.0.3/src/method_security/issues/types/issue.py +36 -0
- methodsdk-0.0.3/src/method_security/issues/types/issue_closed_reason.py +5 -0
- methodsdk-0.0.3/src/method_security/issues/types/issue_id.py +3 -0
- methodsdk-0.0.3/src/method_security/issues/types/issue_severity.py +5 -0
- methodsdk-0.0.3/src/method_security/issues/types/issue_status.py +5 -0
- methodsdk-0.0.3/src/method_security/objects/__init__.py +32 -0
- methodsdk-0.0.3/src/method_security/objects/types/__init__.py +32 -0
- methodsdk-0.0.3/src/method_security/objects/types/object_id.py +3 -0
- methodsdk-0.0.3/src/method_security/py.typed +0 -0
- methodsdk-0.0.3/src/method_security/version.py +3 -0
methodsdk-0.0.3/PKG-INFO
ADDED
@@ -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,155 @@
|
|
1
|
+
# MethodSecurity Python Library
|
2
|
+
|
3
|
+
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fmethod-security%2Fmethod-python-sdk)
|
4
|
+
[](https://pypi.python.org/pypi/methodsdk)
|
5
|
+
|
6
|
+
The MethodSecurity Python library provides convenient access to the MethodSecurity APIs from Python.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
```sh
|
11
|
+
pip install methodsdk
|
12
|
+
```
|
13
|
+
|
14
|
+
## Reference
|
15
|
+
|
16
|
+
A full reference for this library is available [here](https://github.com/method-security/method-python-sdk/blob/HEAD/./reference.md).
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
Instantiate and use the client with the following:
|
21
|
+
|
22
|
+
```python
|
23
|
+
from method_security import MethodSecurityApi
|
24
|
+
|
25
|
+
client = MethodSecurityApi(
|
26
|
+
base_url="https://yourhost.com/path/to/api",
|
27
|
+
)
|
28
|
+
client.issues.get_issue(
|
29
|
+
id="ri.method.ontology.issue.8c99d39e-4b5f-331c-8119-7d177fb4f498",
|
30
|
+
)
|
31
|
+
```
|
32
|
+
|
33
|
+
## Async Client
|
34
|
+
|
35
|
+
The SDK also exports an `async` client so that you can make non-blocking calls to our API.
|
36
|
+
|
37
|
+
```python
|
38
|
+
import asyncio
|
39
|
+
|
40
|
+
from method_security import AsyncMethodSecurityApi
|
41
|
+
|
42
|
+
client = AsyncMethodSecurityApi(
|
43
|
+
base_url="https://yourhost.com/path/to/api",
|
44
|
+
)
|
45
|
+
|
46
|
+
|
47
|
+
async def main() -> None:
|
48
|
+
await client.issues.get_issue(
|
49
|
+
id="ri.method.ontology.issue.8c99d39e-4b5f-331c-8119-7d177fb4f498",
|
50
|
+
)
|
51
|
+
|
52
|
+
|
53
|
+
asyncio.run(main())
|
54
|
+
```
|
55
|
+
|
56
|
+
## Exception Handling
|
57
|
+
|
58
|
+
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
|
59
|
+
will be thrown.
|
60
|
+
|
61
|
+
```python
|
62
|
+
from method_security.core.api_error import ApiError
|
63
|
+
|
64
|
+
try:
|
65
|
+
client.issues.get_issue()
|
66
|
+
except ApiError as e:
|
67
|
+
print(e.status_code)
|
68
|
+
print(e.body)
|
69
|
+
```
|
70
|
+
|
71
|
+
## Advanced
|
72
|
+
|
73
|
+
### Access Raw Response Data
|
74
|
+
|
75
|
+
The SDK provides access to raw response data, including headers, through the `.with_raw_response` property.
|
76
|
+
The `.with_raw_response` property returns a "raw" client that can be used to access the `.headers` and `.data` attributes.
|
77
|
+
|
78
|
+
```python
|
79
|
+
from method_security import MethodSecurityApi
|
80
|
+
|
81
|
+
client = MethodSecurityApi(
|
82
|
+
...,
|
83
|
+
)
|
84
|
+
response = client.issues.with_raw_response.get_issue()
|
85
|
+
print(response.headers) # access the response headers
|
86
|
+
print(response.data) # access the underlying object
|
87
|
+
```
|
88
|
+
|
89
|
+
### Retries
|
90
|
+
|
91
|
+
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
|
92
|
+
as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
|
93
|
+
retry limit (default: 2).
|
94
|
+
|
95
|
+
A request is deemed retryable when any of the following HTTP status codes is returned:
|
96
|
+
|
97
|
+
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
|
98
|
+
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
|
99
|
+
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
|
100
|
+
|
101
|
+
Use the `max_retries` request option to configure this behavior.
|
102
|
+
|
103
|
+
```python
|
104
|
+
client.issues.get_issue(request_options={
|
105
|
+
"max_retries": 1
|
106
|
+
})
|
107
|
+
```
|
108
|
+
|
109
|
+
### Timeouts
|
110
|
+
|
111
|
+
The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
|
112
|
+
|
113
|
+
```python
|
114
|
+
|
115
|
+
from method_security import MethodSecurityApi
|
116
|
+
|
117
|
+
client = MethodSecurityApi(
|
118
|
+
...,
|
119
|
+
timeout=20.0,
|
120
|
+
)
|
121
|
+
|
122
|
+
|
123
|
+
# Override timeout for a specific method
|
124
|
+
client.issues.get_issue(request_options={
|
125
|
+
"timeout_in_seconds": 1
|
126
|
+
})
|
127
|
+
```
|
128
|
+
|
129
|
+
### Custom Client
|
130
|
+
|
131
|
+
You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
|
132
|
+
and transports.
|
133
|
+
|
134
|
+
```python
|
135
|
+
import httpx
|
136
|
+
from method_security import MethodSecurityApi
|
137
|
+
|
138
|
+
client = MethodSecurityApi(
|
139
|
+
...,
|
140
|
+
httpx_client=httpx.Client(
|
141
|
+
proxies="http://my.test.proxy.example.com",
|
142
|
+
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
|
143
|
+
),
|
144
|
+
)
|
145
|
+
```
|
146
|
+
|
147
|
+
## Contributing
|
148
|
+
|
149
|
+
While we value open-source contributions to this SDK, this library is generated programmatically.
|
150
|
+
Additions made directly to this library would have to be moved over to our generation code,
|
151
|
+
otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
|
152
|
+
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
|
153
|
+
an issue first to discuss with us!
|
154
|
+
|
155
|
+
On the other hand, contributions to the README are always very welcome!
|
@@ -0,0 +1,84 @@
|
|
1
|
+
[project]
|
2
|
+
name = "methodsdk"
|
3
|
+
|
4
|
+
[tool.poetry]
|
5
|
+
name = "methodsdk"
|
6
|
+
version = "0.0.3"
|
7
|
+
description = ""
|
8
|
+
readme = "README.md"
|
9
|
+
authors = []
|
10
|
+
keywords = []
|
11
|
+
|
12
|
+
classifiers = [
|
13
|
+
"Intended Audience :: Developers",
|
14
|
+
"Programming Language :: Python",
|
15
|
+
"Programming Language :: Python :: 3",
|
16
|
+
"Programming Language :: Python :: 3.8",
|
17
|
+
"Programming Language :: Python :: 3.9",
|
18
|
+
"Programming Language :: Python :: 3.10",
|
19
|
+
"Programming Language :: Python :: 3.11",
|
20
|
+
"Programming Language :: Python :: 3.12",
|
21
|
+
"Operating System :: OS Independent",
|
22
|
+
"Operating System :: POSIX",
|
23
|
+
"Operating System :: MacOS",
|
24
|
+
"Operating System :: POSIX :: Linux",
|
25
|
+
"Operating System :: Microsoft :: Windows",
|
26
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
27
|
+
"Typing :: Typed"
|
28
|
+
]
|
29
|
+
packages = [
|
30
|
+
{ include = "method_security", from = "src"}
|
31
|
+
]
|
32
|
+
|
33
|
+
[project.urls]
|
34
|
+
Repository = 'https://github.com/method-security/method-python-sdk'
|
35
|
+
|
36
|
+
[tool.poetry.dependencies]
|
37
|
+
python = "^3.8"
|
38
|
+
httpx = ">=0.21.2"
|
39
|
+
pydantic = ">= 1.9.2"
|
40
|
+
pydantic-core = ">=2.18.2"
|
41
|
+
typing_extensions = ">= 4.0.0"
|
42
|
+
|
43
|
+
[tool.poetry.group.dev.dependencies]
|
44
|
+
mypy = "==1.13.0"
|
45
|
+
pytest = "^7.4.0"
|
46
|
+
pytest-asyncio = "^0.23.5"
|
47
|
+
python-dateutil = "^2.9.0"
|
48
|
+
types-python-dateutil = "^2.9.0.20240316"
|
49
|
+
ruff = "==0.11.5"
|
50
|
+
|
51
|
+
[tool.pytest.ini_options]
|
52
|
+
testpaths = [ "tests" ]
|
53
|
+
asyncio_mode = "auto"
|
54
|
+
|
55
|
+
[tool.mypy]
|
56
|
+
plugins = ["pydantic.mypy"]
|
57
|
+
|
58
|
+
[tool.ruff]
|
59
|
+
line-length = 120
|
60
|
+
|
61
|
+
[tool.ruff.lint]
|
62
|
+
select = [
|
63
|
+
"E", # pycodestyle errors
|
64
|
+
"F", # pyflakes
|
65
|
+
"I", # isort
|
66
|
+
]
|
67
|
+
ignore = [
|
68
|
+
"E402", # Module level import not at top of file
|
69
|
+
"E501", # Line too long
|
70
|
+
"E711", # Comparison to `None` should be `cond is not None`
|
71
|
+
"E712", # Avoid equality comparisons to `True`; use `if ...:` checks
|
72
|
+
"E721", # Use `is` and `is not` for type comparisons, or `isinstance()` for insinstance checks
|
73
|
+
"E722", # Do not use bare `except`
|
74
|
+
"E731", # Do not assign a `lambda` expression, use a `def`
|
75
|
+
"F821", # Undefined name
|
76
|
+
"F841" # Local variable ... is assigned to but never used
|
77
|
+
]
|
78
|
+
|
79
|
+
[tool.ruff.lint.isort]
|
80
|
+
section-order = ["future", "standard-library", "third-party", "first-party"]
|
81
|
+
|
82
|
+
[build-system]
|
83
|
+
requires = ["poetry-core"]
|
84
|
+
build-backend = "poetry.core.masonry.api"
|
@@ -0,0 +1,67 @@
|
|
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 . import common, issues, objects
|
10
|
+
from .client import AsyncMethodSecurityApi, MethodSecurityApi
|
11
|
+
from .common import EnvironmentId
|
12
|
+
from .issues import Issue, IssueClosedReason, IssueDoesNotExistError, IssueId, IssueSeverity, IssueStatus
|
13
|
+
from .objects import ObjectId
|
14
|
+
from .version import __version__
|
15
|
+
_dynamic_imports: typing.Dict[str, str] = {
|
16
|
+
"AsyncMethodSecurityApi": ".client",
|
17
|
+
"EnvironmentId": ".common",
|
18
|
+
"Issue": ".issues",
|
19
|
+
"IssueClosedReason": ".issues",
|
20
|
+
"IssueDoesNotExistError": ".issues",
|
21
|
+
"IssueId": ".issues",
|
22
|
+
"IssueSeverity": ".issues",
|
23
|
+
"IssueStatus": ".issues",
|
24
|
+
"MethodSecurityApi": ".client",
|
25
|
+
"ObjectId": ".objects",
|
26
|
+
"__version__": ".version",
|
27
|
+
"common": ".",
|
28
|
+
"issues": ".",
|
29
|
+
"objects": ".",
|
30
|
+
}
|
31
|
+
|
32
|
+
|
33
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
34
|
+
module_name = _dynamic_imports.get(attr_name)
|
35
|
+
if module_name is None:
|
36
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
37
|
+
try:
|
38
|
+
module = import_module(module_name, __package__)
|
39
|
+
result = getattr(module, attr_name)
|
40
|
+
return result
|
41
|
+
except ImportError as e:
|
42
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
43
|
+
except AttributeError as e:
|
44
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
45
|
+
|
46
|
+
|
47
|
+
def __dir__():
|
48
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
49
|
+
return sorted(lazy_attrs)
|
50
|
+
|
51
|
+
|
52
|
+
__all__ = [
|
53
|
+
"AsyncMethodSecurityApi",
|
54
|
+
"EnvironmentId",
|
55
|
+
"Issue",
|
56
|
+
"IssueClosedReason",
|
57
|
+
"IssueDoesNotExistError",
|
58
|
+
"IssueId",
|
59
|
+
"IssueSeverity",
|
60
|
+
"IssueStatus",
|
61
|
+
"MethodSecurityApi",
|
62
|
+
"ObjectId",
|
63
|
+
"__version__",
|
64
|
+
"common",
|
65
|
+
"issues",
|
66
|
+
"objects",
|
67
|
+
]
|
@@ -0,0 +1,137 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
import typing
|
6
|
+
|
7
|
+
import httpx
|
8
|
+
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
9
|
+
|
10
|
+
if typing.TYPE_CHECKING:
|
11
|
+
from .issues.client import AsyncIssuesClient, IssuesClient
|
12
|
+
|
13
|
+
|
14
|
+
class MethodSecurityApi:
|
15
|
+
"""
|
16
|
+
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
|
17
|
+
|
18
|
+
Parameters
|
19
|
+
----------
|
20
|
+
base_url : str
|
21
|
+
The base url to use for requests from the client.
|
22
|
+
|
23
|
+
headers : typing.Optional[typing.Dict[str, str]]
|
24
|
+
Additional headers to send with every request.
|
25
|
+
|
26
|
+
timeout : typing.Optional[float]
|
27
|
+
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
|
28
|
+
|
29
|
+
follow_redirects : typing.Optional[bool]
|
30
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
31
|
+
|
32
|
+
httpx_client : typing.Optional[httpx.Client]
|
33
|
+
The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
|
34
|
+
|
35
|
+
Examples
|
36
|
+
--------
|
37
|
+
from method_security import MethodSecurityApi
|
38
|
+
|
39
|
+
client = MethodSecurityApi(
|
40
|
+
base_url="https://yourhost.com/path/to/api",
|
41
|
+
)
|
42
|
+
"""
|
43
|
+
|
44
|
+
def __init__(
|
45
|
+
self,
|
46
|
+
*,
|
47
|
+
base_url: str,
|
48
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
49
|
+
timeout: typing.Optional[float] = None,
|
50
|
+
follow_redirects: typing.Optional[bool] = True,
|
51
|
+
httpx_client: typing.Optional[httpx.Client] = None,
|
52
|
+
):
|
53
|
+
_defaulted_timeout = (
|
54
|
+
timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read
|
55
|
+
)
|
56
|
+
self._client_wrapper = SyncClientWrapper(
|
57
|
+
base_url=base_url,
|
58
|
+
headers=headers,
|
59
|
+
httpx_client=httpx_client
|
60
|
+
if httpx_client is not None
|
61
|
+
else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
|
62
|
+
if follow_redirects is not None
|
63
|
+
else httpx.Client(timeout=_defaulted_timeout),
|
64
|
+
timeout=_defaulted_timeout,
|
65
|
+
)
|
66
|
+
self._issues: typing.Optional[IssuesClient] = None
|
67
|
+
|
68
|
+
@property
|
69
|
+
def issues(self):
|
70
|
+
if self._issues is None:
|
71
|
+
from .issues.client import IssuesClient # noqa: E402
|
72
|
+
|
73
|
+
self._issues = IssuesClient(client_wrapper=self._client_wrapper)
|
74
|
+
return self._issues
|
75
|
+
|
76
|
+
|
77
|
+
class AsyncMethodSecurityApi:
|
78
|
+
"""
|
79
|
+
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
|
80
|
+
|
81
|
+
Parameters
|
82
|
+
----------
|
83
|
+
base_url : str
|
84
|
+
The base url to use for requests from the client.
|
85
|
+
|
86
|
+
headers : typing.Optional[typing.Dict[str, str]]
|
87
|
+
Additional headers to send with every request.
|
88
|
+
|
89
|
+
timeout : typing.Optional[float]
|
90
|
+
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
|
91
|
+
|
92
|
+
follow_redirects : typing.Optional[bool]
|
93
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
94
|
+
|
95
|
+
httpx_client : typing.Optional[httpx.AsyncClient]
|
96
|
+
The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
|
97
|
+
|
98
|
+
Examples
|
99
|
+
--------
|
100
|
+
from method_security import AsyncMethodSecurityApi
|
101
|
+
|
102
|
+
client = AsyncMethodSecurityApi(
|
103
|
+
base_url="https://yourhost.com/path/to/api",
|
104
|
+
)
|
105
|
+
"""
|
106
|
+
|
107
|
+
def __init__(
|
108
|
+
self,
|
109
|
+
*,
|
110
|
+
base_url: str,
|
111
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
112
|
+
timeout: typing.Optional[float] = None,
|
113
|
+
follow_redirects: typing.Optional[bool] = True,
|
114
|
+
httpx_client: typing.Optional[httpx.AsyncClient] = None,
|
115
|
+
):
|
116
|
+
_defaulted_timeout = (
|
117
|
+
timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read
|
118
|
+
)
|
119
|
+
self._client_wrapper = AsyncClientWrapper(
|
120
|
+
base_url=base_url,
|
121
|
+
headers=headers,
|
122
|
+
httpx_client=httpx_client
|
123
|
+
if httpx_client is not None
|
124
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
|
125
|
+
if follow_redirects is not None
|
126
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout),
|
127
|
+
timeout=_defaulted_timeout,
|
128
|
+
)
|
129
|
+
self._issues: typing.Optional[AsyncIssuesClient] = None
|
130
|
+
|
131
|
+
@property
|
132
|
+
def issues(self):
|
133
|
+
if self._issues is None:
|
134
|
+
from .issues.client import AsyncIssuesClient # noqa: E402
|
135
|
+
|
136
|
+
self._issues = AsyncIssuesClient(client_wrapper=self._client_wrapper)
|
137
|
+
return self._issues
|
@@ -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 EnvironmentId
|
10
|
+
_dynamic_imports: typing.Dict[str, str] = {"EnvironmentId": ".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__ = ["EnvironmentId"]
|
@@ -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 .environment_id import EnvironmentId
|
10
|
+
_dynamic_imports: typing.Dict[str, str] = {"EnvironmentId": ".environment_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__ = ["EnvironmentId"]
|