wellapi 0.2.1__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.
- wellapi-0.2.1/.gitignore +9 -0
- wellapi-0.2.1/.idea/.gitignore +8 -0
- wellapi-0.2.1/.idea/inspectionProfiles/Project_Default.xml +15 -0
- wellapi-0.2.1/.idea/inspectionProfiles/profiles_settings.xml +6 -0
- wellapi-0.2.1/.idea/misc.xml +7 -0
- wellapi-0.2.1/.idea/modules.xml +8 -0
- wellapi-0.2.1/.idea/vcs.xml +6 -0
- wellapi-0.2.1/.idea/wellapi.iml +11 -0
- wellapi-0.2.1/.idea/workspace.xml +170 -0
- wellapi-0.2.1/.python-version +1 -0
- wellapi-0.2.1/PKG-INFO +32 -0
- wellapi-0.2.1/README.md +17 -0
- wellapi-0.2.1/handlers/__init__.py +0 -0
- wellapi-0.2.1/handlers/other.py +85 -0
- wellapi-0.2.1/main.py +19 -0
- wellapi-0.2.1/openapi.json +323 -0
- wellapi-0.2.1/pyproject.toml +56 -0
- wellapi-0.2.1/request.json +129 -0
- wellapi-0.2.1/src/wellapi/__init__.py +5 -0
- wellapi-0.2.1/src/wellapi/__main__.py +3 -0
- wellapi-0.2.1/src/wellapi/applications.py +389 -0
- wellapi-0.2.1/src/wellapi/awsmodel.py +17 -0
- wellapi-0.2.1/src/wellapi/build/__init__.py +0 -0
- wellapi-0.2.1/src/wellapi/build/cdk.py +141 -0
- wellapi-0.2.1/src/wellapi/build/packager.py +82 -0
- wellapi-0.2.1/src/wellapi/build/sam_openapi.py +10 -0
- wellapi-0.2.1/src/wellapi/cli/__init__.py +0 -0
- wellapi-0.2.1/src/wellapi/cli/main.py +67 -0
- wellapi-0.2.1/src/wellapi/convertors.py +89 -0
- wellapi-0.2.1/src/wellapi/datastructures.py +383 -0
- wellapi-0.2.1/src/wellapi/dependencies/__init__.py +0 -0
- wellapi-0.2.1/src/wellapi/dependencies/models.py +138 -0
- wellapi-0.2.1/src/wellapi/dependencies/utils.py +923 -0
- wellapi-0.2.1/src/wellapi/exceptions.py +53 -0
- wellapi-0.2.1/src/wellapi/local/__init__.py +0 -0
- wellapi-0.2.1/src/wellapi/local/reloader.py +94 -0
- wellapi-0.2.1/src/wellapi/local/router.py +116 -0
- wellapi-0.2.1/src/wellapi/local/server.py +154 -0
- wellapi-0.2.1/src/wellapi/middleware/__init__.py +0 -0
- wellapi-0.2.1/src/wellapi/middleware/base.py +18 -0
- wellapi-0.2.1/src/wellapi/middleware/error.py +239 -0
- wellapi-0.2.1/src/wellapi/middleware/exceptions.py +74 -0
- wellapi-0.2.1/src/wellapi/middleware/main.py +26 -0
- wellapi-0.2.1/src/wellapi/models.py +150 -0
- wellapi-0.2.1/src/wellapi/openapi/__init__.py +0 -0
- wellapi-0.2.1/src/wellapi/openapi/docs.py +344 -0
- wellapi-0.2.1/src/wellapi/openapi/models.py +404 -0
- wellapi-0.2.1/src/wellapi/openapi/utils.py +535 -0
- wellapi-0.2.1/src/wellapi/params.py +481 -0
- wellapi-0.2.1/src/wellapi/routing.py +248 -0
- wellapi-0.2.1/src/wellapi/security.py +82 -0
- wellapi-0.2.1/src/wellapi/utils.py +37 -0
- wellapi-0.2.1/uv.lock +1429 -0
wellapi-0.2.1/.gitignore
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<component name="InspectionProjectProfileManager">
|
|
2
|
+
<profile version="1.0">
|
|
3
|
+
<option name="myName" value="Project Default" />
|
|
4
|
+
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
5
|
+
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
|
6
|
+
<option name="ignoredPackages">
|
|
7
|
+
<value>
|
|
8
|
+
<list size="1">
|
|
9
|
+
<item index="0" class="java.lang.String" itemvalue="pydantic" />
|
|
10
|
+
</list>
|
|
11
|
+
</value>
|
|
12
|
+
</option>
|
|
13
|
+
</inspection_tool>
|
|
14
|
+
</profile>
|
|
15
|
+
</component>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="Black">
|
|
4
|
+
<option name="sdkName" value="uv (wellapi)" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="uv (wellapi)" project-jdk-type="Python SDK" />
|
|
7
|
+
</project>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="PYTHON_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$">
|
|
5
|
+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
|
7
|
+
</content>
|
|
8
|
+
<orderEntry type="jdk" jdkName="uv (wellapi)" jdkType="Python SDK" />
|
|
9
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
10
|
+
</component>
|
|
11
|
+
</module>
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="AutoImportSettings">
|
|
4
|
+
<option name="autoReloadType" value="SELECTIVE" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ChangeListManager">
|
|
7
|
+
<list default="true" id="a69cdfb3-9403-45fc-a8f9-42a7bd90bd96" name="Changes" comment="" />
|
|
8
|
+
<option name="SHOW_DIALOG" value="false" />
|
|
9
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
10
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
11
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
12
|
+
</component>
|
|
13
|
+
<component name="ChangesViewManager">
|
|
14
|
+
<option name="groupingKeys">
|
|
15
|
+
<option value="directory" />
|
|
16
|
+
</option>
|
|
17
|
+
</component>
|
|
18
|
+
<component name="FileTemplateManagerImpl">
|
|
19
|
+
<option name="RECENT_TEMPLATES">
|
|
20
|
+
<list>
|
|
21
|
+
<option value="Python Script" />
|
|
22
|
+
</list>
|
|
23
|
+
</option>
|
|
24
|
+
</component>
|
|
25
|
+
<component name="Git.Settings">
|
|
26
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
27
|
+
</component>
|
|
28
|
+
<component name="HttpClientEndpointsTabState">
|
|
29
|
+
<option name="cachedRequestData" value="<CachedHttpClientTabRequests> <entry key="39b9655401d7f6c028b403468476bb3e80484abf" value="###&#10;POST http://localhost:8000/ping/{{user_id}}" /> </CachedHttpClientTabRequests>" />
|
|
30
|
+
</component>
|
|
31
|
+
<component name="ProjectColorInfo">{
|
|
32
|
+
"associatedIndex": 8
|
|
33
|
+
}</component>
|
|
34
|
+
<component name="ProjectId" id="2viC7QcJPBTHeK8DgOFkBs2H8OJ" />
|
|
35
|
+
<component name="ProjectViewState">
|
|
36
|
+
<option name="hideEmptyMiddlePackages" value="true" />
|
|
37
|
+
<option name="showLibraryContents" value="true" />
|
|
38
|
+
</component>
|
|
39
|
+
<component name="PropertiesComponent"><![CDATA[{
|
|
40
|
+
"keyToString": {
|
|
41
|
+
"Python.build.executor": "Run",
|
|
42
|
+
"Python.wellapi.executor": "Run",
|
|
43
|
+
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
44
|
+
"RunOnceActivity.git.unshallow": "true",
|
|
45
|
+
"git-widget-placeholder": "main",
|
|
46
|
+
"last_opened_file_path": "/Users/ramses/dev/wellapi/handlers",
|
|
47
|
+
"node.js.detected.package.eslint": "true",
|
|
48
|
+
"node.js.detected.package.tslint": "true",
|
|
49
|
+
"node.js.selected.package.eslint": "(autodetect)",
|
|
50
|
+
"node.js.selected.package.tslint": "(autodetect)",
|
|
51
|
+
"nodejs_package_manager_path": "npm",
|
|
52
|
+
"vue.rearranger.settings.migration": "true"
|
|
53
|
+
}
|
|
54
|
+
}]]></component>
|
|
55
|
+
<component name="RecentsManager">
|
|
56
|
+
<key name="CopyFile.RECENT_KEYS">
|
|
57
|
+
<recent name="$PROJECT_DIR$/handlers" />
|
|
58
|
+
<recent name="$PROJECT_DIR$" />
|
|
59
|
+
<recent name="$PROJECT_DIR$/src/wellapi/openapi" />
|
|
60
|
+
</key>
|
|
61
|
+
<key name="MoveFile.RECENT_KEYS">
|
|
62
|
+
<recent name="$PROJECT_DIR$/app" />
|
|
63
|
+
<recent name="$PROJECT_DIR$/src/wellapi" />
|
|
64
|
+
</key>
|
|
65
|
+
</component>
|
|
66
|
+
<component name="RunManager" selected="Python.build">
|
|
67
|
+
<configuration name="build" type="PythonConfigurationType" factoryName="Python">
|
|
68
|
+
<module name="wellapi" />
|
|
69
|
+
<option name="ENV_FILES" value="" />
|
|
70
|
+
<option name="INTERPRETER_OPTIONS" value="" />
|
|
71
|
+
<option name="PARENT_ENVS" value="true" />
|
|
72
|
+
<envs>
|
|
73
|
+
<env name="PYTHONUNBUFFERED" value="1" />
|
|
74
|
+
</envs>
|
|
75
|
+
<option name="SDK_HOME" value="" />
|
|
76
|
+
<option name="SDK_NAME" value="uv (wellapi)" />
|
|
77
|
+
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
78
|
+
<option name="IS_MODULE_SDK" value="false" />
|
|
79
|
+
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
80
|
+
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
81
|
+
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
|
82
|
+
<option name="SCRIPT_NAME" value="wellapi" />
|
|
83
|
+
<option name="PARAMETERS" value="build" />
|
|
84
|
+
<option name="SHOW_COMMAND_LINE" value="false" />
|
|
85
|
+
<option name="EMULATE_TERMINAL" value="false" />
|
|
86
|
+
<option name="MODULE_MODE" value="true" />
|
|
87
|
+
<option name="REDIRECT_INPUT" value="false" />
|
|
88
|
+
<option name="INPUT_FILE" value="" />
|
|
89
|
+
<method v="2" />
|
|
90
|
+
</configuration>
|
|
91
|
+
<configuration name="wellapi" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
|
|
92
|
+
<module name="wellapi" />
|
|
93
|
+
<option name="ENV_FILES" value="" />
|
|
94
|
+
<option name="INTERPRETER_OPTIONS" value="" />
|
|
95
|
+
<option name="PARENT_ENVS" value="true" />
|
|
96
|
+
<envs>
|
|
97
|
+
<env name="PYTHONUNBUFFERED" value="1" />
|
|
98
|
+
</envs>
|
|
99
|
+
<option name="SDK_HOME" value="" />
|
|
100
|
+
<option name="SDK_NAME" value="uv (wellapi)" />
|
|
101
|
+
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
102
|
+
<option name="IS_MODULE_SDK" value="false" />
|
|
103
|
+
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
104
|
+
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
105
|
+
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
|
106
|
+
<option name="SCRIPT_NAME" value="wellapi" />
|
|
107
|
+
<option name="PARAMETERS" value="run" />
|
|
108
|
+
<option name="SHOW_COMMAND_LINE" value="false" />
|
|
109
|
+
<option name="EMULATE_TERMINAL" value="false" />
|
|
110
|
+
<option name="MODULE_MODE" value="true" />
|
|
111
|
+
<option name="REDIRECT_INPUT" value="false" />
|
|
112
|
+
<option name="INPUT_FILE" value="" />
|
|
113
|
+
<method v="2" />
|
|
114
|
+
</configuration>
|
|
115
|
+
<list>
|
|
116
|
+
<item itemvalue="Python.wellapi" />
|
|
117
|
+
<item itemvalue="Python.build" />
|
|
118
|
+
</list>
|
|
119
|
+
</component>
|
|
120
|
+
<component name="SharedIndexes">
|
|
121
|
+
<attachedChunks>
|
|
122
|
+
<set>
|
|
123
|
+
<option value="bundled-js-predefined-d6986cc7102b-1632447f56bf-JavaScript-PY-243.26053.29" />
|
|
124
|
+
<option value="bundled-python-sdk-b1dbf8ef85a6-4df51de95216-com.jetbrains.pycharm.pro.sharedIndexes.bundled-PY-243.26053.29" />
|
|
125
|
+
</set>
|
|
126
|
+
</attachedChunks>
|
|
127
|
+
</component>
|
|
128
|
+
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
|
129
|
+
<component name="TaskManager">
|
|
130
|
+
<task active="true" id="Default" summary="Default task">
|
|
131
|
+
<changelist id="a69cdfb3-9403-45fc-a8f9-42a7bd90bd96" name="Changes" comment="" />
|
|
132
|
+
<created>1744618341018</created>
|
|
133
|
+
<option name="number" value="Default" />
|
|
134
|
+
<option name="presentableId" value="Default" />
|
|
135
|
+
<updated>1744618341018</updated>
|
|
136
|
+
<workItem from="1744618342097" duration="6000000" />
|
|
137
|
+
<workItem from="1744627187173" duration="43000" />
|
|
138
|
+
<workItem from="1744627237123" duration="45694000" />
|
|
139
|
+
</task>
|
|
140
|
+
<servers />
|
|
141
|
+
</component>
|
|
142
|
+
<component name="TypeScriptGeneratedFilesManager">
|
|
143
|
+
<option name="version" value="3" />
|
|
144
|
+
</component>
|
|
145
|
+
<component name="XDebuggerManager">
|
|
146
|
+
<breakpoint-manager>
|
|
147
|
+
<breakpoints>
|
|
148
|
+
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
|
149
|
+
<url>file://$PROJECT_DIR$/src/wellapi/dependencies/utils.py</url>
|
|
150
|
+
<line>765</line>
|
|
151
|
+
<option name="timeStamp" value="9" />
|
|
152
|
+
</line-breakpoint>
|
|
153
|
+
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
|
154
|
+
<url>file://$PROJECT_DIR$/src/wellapi/local/server.py</url>
|
|
155
|
+
<line>116</line>
|
|
156
|
+
<option name="timeStamp" value="10" />
|
|
157
|
+
</line-breakpoint>
|
|
158
|
+
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
|
159
|
+
<url>file://$PROJECT_DIR$/src/wellapi/datastructures.py</url>
|
|
160
|
+
<line>192</line>
|
|
161
|
+
<option name="timeStamp" value="12" />
|
|
162
|
+
</line-breakpoint>
|
|
163
|
+
</breakpoints>
|
|
164
|
+
</breakpoint-manager>
|
|
165
|
+
</component>
|
|
166
|
+
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
|
167
|
+
<SUITE FILE_PATH="coverage/wellapi$wellapi.coverage" NAME="wellapi Coverage Results" MODIFIED="1744797586149" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
|
168
|
+
<SUITE FILE_PATH="coverage/wellapi$build.coverage" NAME="build Coverage Results" MODIFIED="1744799111852" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
|
169
|
+
</component>
|
|
170
|
+
</project>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
wellapi-0.2.1/PKG-INFO
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wellapi
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Add your description here
|
|
5
|
+
Author-email: ramses <romayuhym@gmail.com>
|
|
6
|
+
Requires-Python: >=3.12
|
|
7
|
+
Requires-Dist: aws-cdk-lib>=2.189.1
|
|
8
|
+
Requires-Dist: email-validator>=2.0.0
|
|
9
|
+
Requires-Dist: pydantic==2.11.3
|
|
10
|
+
Requires-Dist: typing-extensions>=4.8.0
|
|
11
|
+
Provides-Extra: standard
|
|
12
|
+
Requires-Dist: click>=8.1.8; extra == 'standard'
|
|
13
|
+
Requires-Dist: watchdog>=4.0.2; extra == 'standard'
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
TODO
|
|
17
|
+
|
|
18
|
+
- [ ] OpenAPI
|
|
19
|
+
- [X] Request validation
|
|
20
|
+
- [ ] CORS
|
|
21
|
+
- [ ] x-api-key
|
|
22
|
+
- [ ] cache
|
|
23
|
+
- [ ] access log
|
|
24
|
+
- [ ] Build
|
|
25
|
+
- [ ] Clean up
|
|
26
|
+
- [x] Use multi Value Request Parameters (Headers, QueryString)
|
|
27
|
+
- [ ] Check AWS warning
|
|
28
|
+
|
|
29
|
+
The API with ID 6526xo4n92 doesn’t include a resource with path /* having an integration arn:aws:lambda:eu-central-1:985539757029:function:MainHelloFunction on the ANY method.
|
|
30
|
+
|
|
31
|
+
The API with ID doesn’t include a resource with path /* having an integration on the ANY method.
|
|
32
|
+
- [ ] [Dependency groups](https://docs.astral.sh/uv/concepts/projects/dependencies/)
|
wellapi-0.2.1/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
TODO
|
|
2
|
+
|
|
3
|
+
- [ ] OpenAPI
|
|
4
|
+
- [X] Request validation
|
|
5
|
+
- [ ] CORS
|
|
6
|
+
- [ ] x-api-key
|
|
7
|
+
- [ ] cache
|
|
8
|
+
- [ ] access log
|
|
9
|
+
- [ ] Build
|
|
10
|
+
- [ ] Clean up
|
|
11
|
+
- [x] Use multi Value Request Parameters (Headers, QueryString)
|
|
12
|
+
- [ ] Check AWS warning
|
|
13
|
+
|
|
14
|
+
The API with ID 6526xo4n92 doesn’t include a resource with path /* having an integration arn:aws:lambda:eu-central-1:985539757029:function:MainHelloFunction on the ANY method.
|
|
15
|
+
|
|
16
|
+
The API with ID doesn’t include a resource with path /* having an integration on the ANY method.
|
|
17
|
+
- [ ] [Dependency groups](https://docs.astral.sh/uv/concepts/projects/dependencies/)
|
|
File without changes
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
from typing import Annotated
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, Field
|
|
4
|
+
|
|
5
|
+
from main import app
|
|
6
|
+
from wellapi.exceptions import HTTPException, RequestValidationError
|
|
7
|
+
from wellapi.models import RequestAPIGateway, ResponseAPIGateway
|
|
8
|
+
from wellapi.params import Query, Depends
|
|
9
|
+
from wellapi.security import OAuth2PasswordBearer
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class OtherResponse(BaseModel):
|
|
13
|
+
message: str
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class OtherBody(BaseModel):
|
|
17
|
+
name: str
|
|
18
|
+
age: int
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class FilterParams(BaseModel):
|
|
22
|
+
limit: int = Field(100, gt=0, le=100)
|
|
23
|
+
offset: int = Field(0, ge=0)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def verify_token(token: Annotated[str, Depends(oauth2_scheme)]):
|
|
30
|
+
if token != "fake-token":
|
|
31
|
+
raise HTTPException(status_code=403, detail="Not authenticated")
|
|
32
|
+
|
|
33
|
+
return token
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class Session:
|
|
37
|
+
def __init__(self):
|
|
38
|
+
self.session = "session"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def db() -> Session:
|
|
42
|
+
print("DB connection")
|
|
43
|
+
return Session()
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@app.post(
|
|
47
|
+
"/ping/{ping_id}",
|
|
48
|
+
dependencies=[Depends(verify_token)],
|
|
49
|
+
status_code=201,
|
|
50
|
+
tags=["ping"],
|
|
51
|
+
)
|
|
52
|
+
def ping(ping_id: int, item: list[OtherBody], token: Annotated[str, Depends(verify_token)]) -> OtherResponse:
|
|
53
|
+
return OtherResponse(
|
|
54
|
+
message=f"Pong {ping_id}. {token}",
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@app.post("/ping", dependencies=[Depends(verify_token)], status_code=201, tags=["ping"])
|
|
59
|
+
def ping_v2(item: list[OtherBody], param: Annotated[FilterParams, Query()]) -> OtherResponse:
|
|
60
|
+
return OtherResponse(
|
|
61
|
+
message=f"Pong {param.limit} {param.offset}",
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@app.sqs("ping-sqs")
|
|
66
|
+
def ping_sqs(events: list[OtherBody]):
|
|
67
|
+
print(events)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@app.job("rate(5 minutes)", name="ping_job")
|
|
71
|
+
def ping_job(dbbb: Annotated[Session, Depends(db)]):
|
|
72
|
+
print(f"Ping job {dbbb.session}")
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
@app.middleware()
|
|
76
|
+
def db_connection(request: RequestAPIGateway, next_call) -> ResponseAPIGateway:
|
|
77
|
+
print("Before request")
|
|
78
|
+
response = next_call(request)
|
|
79
|
+
print("After request")
|
|
80
|
+
return response
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
@app.exception_handler(RequestValidationError)
|
|
84
|
+
def validation_exception_handler(request, exc):
|
|
85
|
+
return ResponseAPIGateway(exc.errors(), status_code=422)
|
wellapi-0.2.1/main.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from typing import Annotated
|
|
2
|
+
|
|
3
|
+
from wellapi import WellApi as FastAPI
|
|
4
|
+
from wellapi.params import Header
|
|
5
|
+
|
|
6
|
+
app = FastAPI(
|
|
7
|
+
debug=True,
|
|
8
|
+
servers=[{"url": "http://localhost:8000", "description": "Local server"}],
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@app.get("/hello")
|
|
13
|
+
def hello(test: Annotated[list[str] | None, Header()]):
|
|
14
|
+
"""
|
|
15
|
+
A simple hello world endpoint.
|
|
16
|
+
:return:
|
|
17
|
+
"""
|
|
18
|
+
print(test)
|
|
19
|
+
return test
|