korail-py-SDK 0.1.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.
- korail_py_sdk-0.1.1/LICENSE +202 -0
- korail_py_sdk-0.1.1/MANIFEST.in +20 -0
- korail_py_sdk-0.1.1/NOTICE +21 -0
- korail_py_sdk-0.1.1/PKG-INFO +163 -0
- korail_py_sdk-0.1.1/README.md +133 -0
- korail_py_sdk-0.1.1/docs/ARCHITECTURE.md +62 -0
- korail_py_sdk-0.1.1/docs/CHANGELOG.md +28 -0
- korail_py_sdk-0.1.1/docs/LEGAL.md +41 -0
- korail_py_sdk-0.1.1/docs/PROVENANCE.md +31 -0
- korail_py_sdk-0.1.1/docs/THIRD_PARTY_NOTICES.md +39 -0
- korail_py_sdk-0.1.1/docs/VALIDATION.md +30 -0
- korail_py_sdk-0.1.1/pyproject.toml +70 -0
- korail_py_sdk-0.1.1/setup.cfg +4 -0
- korail_py_sdk-0.1.1/src/korail_py_SDK.egg-info/SOURCES.txt +90 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/__init__.py +34 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/__init__.pyi +496 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/api/__init__.py +0 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/api/annotations.py +82 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/api/client.py +365 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/api/client.pyi +279 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/api/facade.py +202 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/api/facade.pyi +93 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/configuration/__init__.py +0 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/configuration/device.py +113 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/maintenance.py +214 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/maintenance.pyi +39 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/messages/__init__.py +0 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/messages/catalog.py +70 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/models/__init__.py +0 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/models/errors.py +122 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/models/errors.pyi +216 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/models/records.py +489 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/models/records.pyi +4959 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/protocol/__init__.py +0 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/protocol/codec.py +385 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/protocol/envelope.py +27 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/protocol/forms.py +48 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/protocol/parsers.py +41 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/protocol/requests.py +167 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/protocol/schema.py +18 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/py.typed +0 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/resources/contracts/authorization.json +342 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/resources/contracts/constants.json +89 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/resources/contracts/empty-responses.json +35 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/resources/contracts/error-categories.json +185 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/resources/contracts/fingerprint.json +17 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/resources/contracts/gates.json +32 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/resources/contracts/legacy-protocol.json +105 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/resources/contracts/parser-functions.json +310 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/resources/contracts/public-interface.json +35549 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/resources/contracts/requests.json +8243 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/resources/contracts/response-policy.json +326 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/resources/contracts/response-rules.json +479 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/resources/contracts/responses.json +2722 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/resources/contracts/validation-rules.json +1280 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/resources/messages/message-provenance.json +8 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/resources/messages/messages.json +44243 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/security/__init__.py +0 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/security/declaration.py +98 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/security/diagnostic.py +54 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/security/legacy.py +154 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/security/passwords.py +22 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/security/signing.py +57 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/services/__init__.py +0 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/services/authentication.py +125 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/services/compatibility.py +53 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/services/operations.py +324 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/services/payments.py +43 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/services/reservations.py +181 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/services/search.py +51 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/services/validation.py +38 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/transport/__init__.py +0 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/transport/admission.py +247 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/transport/cleanup.py +20 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/transport/curl.py +134 -0
- korail_py_sdk-0.1.1/src/korail_py_sdk/transport/http.py +307 -0
- korail_py_sdk-0.1.1/tests/conftest.py +28 -0
- korail_py_sdk-0.1.1/tests/fixtures/declaration-vectors.json +15 -0
- korail_py_sdk-0.1.1/tests/fixtures/reservation-compatibility.json +1294 -0
- korail_py_sdk-0.1.1/tests/fixtures/synthetic-cases.json +6753 -0
- korail_py_sdk-0.1.1/tests/fixtures/variant-cases.json +18484 -0
- korail_py_sdk-0.1.1/tests/test_declaration_compatibility.py +240 -0
- korail_py_sdk-0.1.1/tests/test_dynapath_errors.py +109 -0
- korail_py_sdk-0.1.1/tests/test_maintenance.py +550 -0
- korail_py_sdk-0.1.1/tests/test_mutation_variants.py +79 -0
- korail_py_sdk-0.1.1/tests/test_proxy_routing.py +51 -0
- korail_py_sdk-0.1.1/tests/test_regressions.py +235 -0
- korail_py_sdk-0.1.1/tests/test_request_lifecycle.py +95 -0
- korail_py_sdk-0.1.1/tests/test_request_signing.py +115 -0
- korail_py_sdk-0.1.1/tests/test_wire_contracts.py +79 -0
- korail_py_sdk-0.1.1/tests/typing_consumer.py +53 -0
- korail_py_sdk-0.1.1/tools/catalog/import_messages.py +61 -0
- korail_py_sdk-0.1.1/tools/packaging/check_artifacts.py +140 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Explicit allowlist: historical code and comparison tools are not release inputs.
|
|
2
|
+
global-exclude *
|
|
3
|
+
include pyproject.toml MANIFEST.in LICENSE NOTICE README.md
|
|
4
|
+
include docs/CHANGELOG.md docs/THIRD_PARTY_NOTICES.md docs/LEGAL.md docs/PROVENANCE.md docs/VALIDATION.md docs/ARCHITECTURE.md
|
|
5
|
+
recursive-include src/korail_py_sdk *.py *.pyi py.typed *.json
|
|
6
|
+
recursive-include tests *.py
|
|
7
|
+
recursive-include tests/fixtures *.json
|
|
8
|
+
include tools/packaging/check_artifacts.py tools/catalog/import_messages.py
|
|
9
|
+
prune reference
|
|
10
|
+
prune analysis
|
|
11
|
+
prune .git
|
|
12
|
+
prune .github
|
|
13
|
+
prune build
|
|
14
|
+
prune dist
|
|
15
|
+
prune .pytest_cache
|
|
16
|
+
prune .ruff_cache
|
|
17
|
+
global-exclude __pycache__ *.py[cod] .DS_Store
|
|
18
|
+
global-exclude *.apk *.apks *.aab *.dex *.so *.dll *.dylib
|
|
19
|
+
global-exclude *.pem *.key *.p12 *.pfx *.jks *.keystore
|
|
20
|
+
global-exclude .env .env.* *.env .pypirc *credentials* *credential* *secrets*
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
korail-api
|
|
2
|
+
Copyright 2026 thsqaz123-dot
|
|
3
|
+
|
|
4
|
+
The maintainer offers only material they have authority to license under
|
|
5
|
+
Apache License 2.0. This unofficial project is not affiliated with KORAIL.
|
|
6
|
+
|
|
7
|
+
Changes in this implementation include separate schema-driven request and
|
|
8
|
+
response engines, generated value objects, service and transport boundaries,
|
|
9
|
+
token serialization, endpoint URL reuse, failure-context
|
|
10
|
+
preservation, independent tests, packaging and English documentation.
|
|
11
|
+
|
|
12
|
+
Bundled vendor message text in src/korail_py_sdk/resources/messages/ was extracted
|
|
13
|
+
from a local KORAIL application resource labeled 7.0.10. It is third-party text,
|
|
14
|
+
not maintainer-authored work. No separate redistribution permission has been
|
|
15
|
+
established. Extraction and attribution are not a rights grant.
|
|
16
|
+
|
|
17
|
+
httpx, cryptography and curl_cffi are separate dependencies subject to their own
|
|
18
|
+
licenses. KORAIL and other third-party marks belong to their respective owners.
|
|
19
|
+
|
|
20
|
+
See docs/LEGAL.md, docs/THIRD_PARTY_NOTICES.md and docs/PROVENANCE.md for scope, source details,
|
|
21
|
+
redistribution conditions and limits. This NOTICE does not modify Apache-2.0.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: korail-py-SDK
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Synchronous KORAIL protocol client
|
|
5
|
+
Author: sontheo
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Repository, https://github.com/sontheo/KORAIL-py-SDK
|
|
8
|
+
Project-URL: Issues, https://github.com/sontheo/KORAIL-py-SDK/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/CHANGELOG.md
|
|
10
|
+
Requires-Python: >=3.11
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
License-File: NOTICE
|
|
14
|
+
License-File: docs/THIRD_PARTY_NOTICES.md
|
|
15
|
+
Requires-Dist: httpx>=0.28.1
|
|
16
|
+
Requires-Dist: cryptography>=50.0.2
|
|
17
|
+
Requires-Dist: curl_cffi==0.16.3
|
|
18
|
+
Provides-Extra: socks
|
|
19
|
+
Requires-Dist: httpx[socks]>=0.28.1; extra == "socks"
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: httpx[socks]>=0.28.1; extra == "dev"
|
|
22
|
+
Requires-Dist: pytest>=8.3; extra == "dev"
|
|
23
|
+
Requires-Dist: build>=1.2.2; extra == "dev"
|
|
24
|
+
Requires-Dist: twine>=6; extra == "dev"
|
|
25
|
+
Requires-Dist: ruff>=0.11; extra == "dev"
|
|
26
|
+
Requires-Dist: mypy>=1.15; extra == "dev"
|
|
27
|
+
Requires-Dist: packaging>=24.2; extra == "dev"
|
|
28
|
+
Requires-Dist: setuptools>=84.2.1; extra == "dev"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
<p align="center">
|
|
32
|
+
<img src="https://raw.githubusercontent.com/sontheo/KORAIL-py-SDK/main/assets/readme-banner.svg" alt="korail-py-SDK — Python client, clear boundaries" width="100%">
|
|
33
|
+
</p>
|
|
34
|
+
|
|
35
|
+
# korail-py-SDK
|
|
36
|
+
|
|
37
|
+
> **Legal notice:** This is an unofficial client, unaffiliated with KORAIL. Apache-2.0 covers material the maintainer can license; it grants no service-access or trademark rights. Vendor message data has separate rights, and no independent redistribution grant has been established. Read [LEGAL.md](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/LEGAL.md), [NOTICE](https://github.com/sontheo/KORAIL-py-SDK/blob/main/NOTICE), [third-party notices](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/THIRD_PARTY_NOTICES.md) and [provenance](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/PROVENANCE.md) before use or redistribution.
|
|
38
|
+
|
|
39
|
+
[](https://github.com/sontheo/KORAIL-py-SDK/blob/main/pyproject.toml)
|
|
40
|
+
[](https://github.com/sontheo/KORAIL-py-SDK/blob/main/LICENSE)
|
|
41
|
+
[](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/VALIDATION.md)
|
|
42
|
+
|
|
43
|
+
A synchronous Python client for the KORAIL protocol, organized around separate transport, protocol, service and model layers. Import the public client and models from `korail_py_sdk`.
|
|
44
|
+
|
|
45
|
+
**[Documentation](https://sontheo.github.io/KORAIL-py-SDK/)** · **[Architecture](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/ARCHITECTURE.md)** · **[Validation](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/VALIDATION.md)** · **[Contributing](https://github.com/sontheo/KORAIL-py-SDK/blob/main/.github/CONTRIBUTING.md)** · **[Legal notice](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/LEGAL.md)**
|
|
46
|
+
|
|
47
|
+
## What it supports
|
|
48
|
+
|
|
49
|
+
| Area | Capabilities |
|
|
50
|
+
| --- | --- |
|
|
51
|
+
| Search | Direct and transfer schedules, pagination, continuation recovery, seat maps |
|
|
52
|
+
| Sessions | Authentication, cookies, configuration, device profiles and explicit proxies |
|
|
53
|
+
| Transactions | Reservations, cancellation, payment and refund operations |
|
|
54
|
+
| Resources | Account and ticket reads, travel products and airport limousine operations |
|
|
55
|
+
| Public API | 239 root exports, 86 public client methods and typed models |
|
|
56
|
+
|
|
57
|
+
Transaction methods can affect real tickets and money. Automated validation is offline; these capabilities are not a claim of current live-service acceptance.
|
|
58
|
+
|
|
59
|
+
## Install
|
|
60
|
+
|
|
61
|
+
Install the `korail-py-SDK` distribution with Python 3.11 or newer:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
python -m pip install korail-py-SDK
|
|
65
|
+
# Optional SOCKS proxy support:
|
|
66
|
+
python -m pip install 'korail-py-SDK[socks]'
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The Python import name is `korail_py_sdk`.
|
|
70
|
+
|
|
71
|
+
## Search example
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from korail_py_sdk import KorailClient, TrainSearchQuery
|
|
75
|
+
|
|
76
|
+
with KorailClient() as client:
|
|
77
|
+
response = client.search_trains(TrainSearchQuery("서울", "부산", "20991230", "090000"))
|
|
78
|
+
for train in response.trains:
|
|
79
|
+
print(train.train_no, train.departure_time)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Replace the example date with a valid travel date. Executing this example sends a real schedule request; automated tests do not execute it.
|
|
83
|
+
|
|
84
|
+
## Behavior that matters
|
|
85
|
+
|
|
86
|
+
- Every search obtains a fresh response; seat availability and transaction outcomes are never cached.
|
|
87
|
+
- Transaction requests are never retried automatically. Check uncertain outcomes through official channels before trying again.
|
|
88
|
+
- The default software declaration profile replaces diagnostic-only tokens; ordinary single-train reservations use the observed GET/query profile. See [configuration and validation limits](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/getting-started.md).
|
|
89
|
+
- Decode failures retain the whole response in `error.raw`, with nested context in `error.parser_raw` when available. Treat both as potentially sensitive.
|
|
90
|
+
- Pagination detects repeated pages and preserves continuation metadata.
|
|
91
|
+
- Business rejection, malformed responses, session expiry and protocol-access rejection remain distinct.
|
|
92
|
+
- HTTP cookies have one owner; curl responses are adapted without a second decompression pass. Credential and payment fields are hidden from generated model representations.
|
|
93
|
+
|
|
94
|
+
## Maintenance and recovery
|
|
95
|
+
|
|
96
|
+
Explicit maintenance/rate-limit responses (including HTTP 429/503) block subsequent requests to the same configured API origin. Two consecutive transport failures also open a cooldown. Defaults are 30 minutes, 1 hour, 2 hours, then 4 hours, plus up to 10% positive jitter; a longer server `Retry-After` takes precedence. Errors expose `status_code`, `retry_after` (seconds) and `next_probe_at` (UTC Unix timestamp) when available. Invalid `strResult` values raise `KorailProtocolError` and retain `raw`.
|
|
97
|
+
|
|
98
|
+
During cooldown, login, queue admission and ordinary API calls fail locally. Once the deadline passes, only a caller-requested `get_service_status()` may probe recovery, and only one probe can run at a time. A successful status response permits ordinary calls again; it does not prove that every login or transaction endpoint is healthy. The library starts no timer, worker or background traffic. Applications should schedule one status check at `next_probe_at` only while work is pending, then resume reads gradually. Never replay an ambiguous reservation/payment automatically.
|
|
99
|
+
|
|
100
|
+
For a single-process application, use the default in-memory policy with no database configuration. Clients in that process share cooldowns and recovery-probe exclusion. Restarting the process clears this state, so the next call may contact the server again.
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
from korail_py_sdk import KorailApiError, KorailClient
|
|
104
|
+
|
|
105
|
+
with KorailClient() as client:
|
|
106
|
+
try:
|
|
107
|
+
status = client.get_service_status()
|
|
108
|
+
except KorailApiError as error:
|
|
109
|
+
if error.next_probe_at is None:
|
|
110
|
+
raise
|
|
111
|
+
next_check_at = error.next_probe_at # Schedule; do not loop immediately.
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
SQLite remains an optional advanced setting for restart persistence or multiple processes: create a `MaintenancePolicy(state_path="/app/data/korail-maintenance.sqlite3")` from `korail_py_sdk.maintenance` and pass it as `KorailClient(maintenance=policy)`. The parent directory must already exist on a local filesystem. The database stores only origins, counters, deadlines and probe leases, without credentials or response bodies; separate hosts need application-level coordination. Set `probe_lease` longer than your longest possible status request when customizing timeouts beyond the default 5-minute lease. Separate policy objects without `state_path` have independent state.
|
|
115
|
+
|
|
116
|
+
Queue transport errors no longer bypass admission to send the API request. Error retries check the remaining queue budget before sleeping or sending again, and there is no sleep after the final failure. Queue admission has a 300-second default budget; explicitly setting `KorailConfig(netfunnel_wait_limit=None)` restores unlimited normal queue waiting. The budget does not cancel an already-running HTTP request or delay token cleanup.
|
|
117
|
+
|
|
118
|
+
These are deliberate behavior corrections: `raise_on_fail=False` cannot bypass maintenance/rate-limit protection, and malformed result envelopes are rejected before later steps in a transaction. Account errors, application-update requirements and protocol-access rejections alone do not establish maintenance.
|
|
119
|
+
|
|
120
|
+
## Architecture
|
|
121
|
+
|
|
122
|
+
```text
|
|
123
|
+
src/
|
|
124
|
+
└── korail_py_sdk/
|
|
125
|
+
├── api/ Public client and convenience resources
|
|
126
|
+
├── services/ Authentication, search and transaction rules
|
|
127
|
+
├── protocol/ Request compilation and response decoding
|
|
128
|
+
├── transport/ HTTP, curl adaptation and queue admission
|
|
129
|
+
├── models/ Value objects, exceptions and type declarations
|
|
130
|
+
├── configuration/ Device and environment settings
|
|
131
|
+
├── security/ Password transformation and token serialization
|
|
132
|
+
├── messages/ Localized message lookup
|
|
133
|
+
└── resources/ Protocol contracts and vendor message data
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
See [ARCHITECTURE.md](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/ARCHITECTURE.md) for ownership boundaries and locations for behavioral changes. The package builds and runs from this repository.
|
|
137
|
+
|
|
138
|
+
## Validation and performance
|
|
139
|
+
|
|
140
|
+
The test suite and decoder comparisons use synthetic data. See [VALIDATION.md](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/VALIDATION.md) for the checks and their limits.
|
|
141
|
+
|
|
142
|
+
Offline benchmarks exercise mock transports and do not establish real KORAIL request latency or acceptance.
|
|
143
|
+
|
|
144
|
+
## Development
|
|
145
|
+
|
|
146
|
+
```sh
|
|
147
|
+
.venv/bin/python -m pip install -e '.[dev]'
|
|
148
|
+
.venv/bin/python -m pytest
|
|
149
|
+
.venv/bin/ruff check .
|
|
150
|
+
.venv/bin/ruff format --check .
|
|
151
|
+
.venv/bin/mypy
|
|
152
|
+
.venv/bin/python -m build
|
|
153
|
+
.venv/bin/python -m twine check dist/*
|
|
154
|
+
.venv/bin/python tools/packaging/check_artifacts.py dist/*.whl --sdist dist/*.tar.gz
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Tests block network traffic and use synthetic data. See [CONTRIBUTING.md](https://github.com/sontheo/KORAIL-py-SDK/blob/main/.github/CONTRIBUTING.md) for repository-only checks, documentation builds and packaging boundaries. Do not include credentials, passenger data, payment details or unredacted responses in issues.
|
|
158
|
+
|
|
159
|
+
## License and provenance
|
|
160
|
+
|
|
161
|
+
The maintainer-authored software is offered under [Apache-2.0](https://github.com/sontheo/KORAIL-py-SDK/blob/main/LICENSE), subject to the scope and notices in [LEGAL.md](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/LEGAL.md), [NOTICE](https://github.com/sontheo/KORAIL-py-SDK/blob/main/NOTICE) and [THIRD_PARTY_NOTICES.md](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/THIRD_PARTY_NOTICES.md).
|
|
162
|
+
|
|
163
|
+
Material provenance is recorded in [PROVENANCE.md](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/PROVENANCE.md). Third-party data, runtime dependencies, trademarks and service-access permissions retain their respective rights. No live login, reservation, cancellation, payment or refund has been used to validate this release.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/sontheo/KORAIL-py-SDK/main/assets/readme-banner.svg" alt="korail-py-SDK — Python client, clear boundaries" width="100%">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# korail-py-SDK
|
|
6
|
+
|
|
7
|
+
> **Legal notice:** This is an unofficial client, unaffiliated with KORAIL. Apache-2.0 covers material the maintainer can license; it grants no service-access or trademark rights. Vendor message data has separate rights, and no independent redistribution grant has been established. Read [LEGAL.md](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/LEGAL.md), [NOTICE](https://github.com/sontheo/KORAIL-py-SDK/blob/main/NOTICE), [third-party notices](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/THIRD_PARTY_NOTICES.md) and [provenance](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/PROVENANCE.md) before use or redistribution.
|
|
8
|
+
|
|
9
|
+
[](https://github.com/sontheo/KORAIL-py-SDK/blob/main/pyproject.toml)
|
|
10
|
+
[](https://github.com/sontheo/KORAIL-py-SDK/blob/main/LICENSE)
|
|
11
|
+
[](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/VALIDATION.md)
|
|
12
|
+
|
|
13
|
+
A synchronous Python client for the KORAIL protocol, organized around separate transport, protocol, service and model layers. Import the public client and models from `korail_py_sdk`.
|
|
14
|
+
|
|
15
|
+
**[Documentation](https://sontheo.github.io/KORAIL-py-SDK/)** · **[Architecture](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/ARCHITECTURE.md)** · **[Validation](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/VALIDATION.md)** · **[Contributing](https://github.com/sontheo/KORAIL-py-SDK/blob/main/.github/CONTRIBUTING.md)** · **[Legal notice](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/LEGAL.md)**
|
|
16
|
+
|
|
17
|
+
## What it supports
|
|
18
|
+
|
|
19
|
+
| Area | Capabilities |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| Search | Direct and transfer schedules, pagination, continuation recovery, seat maps |
|
|
22
|
+
| Sessions | Authentication, cookies, configuration, device profiles and explicit proxies |
|
|
23
|
+
| Transactions | Reservations, cancellation, payment and refund operations |
|
|
24
|
+
| Resources | Account and ticket reads, travel products and airport limousine operations |
|
|
25
|
+
| Public API | 239 root exports, 86 public client methods and typed models |
|
|
26
|
+
|
|
27
|
+
Transaction methods can affect real tickets and money. Automated validation is offline; these capabilities are not a claim of current live-service acceptance.
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
Install the `korail-py-SDK` distribution with Python 3.11 or newer:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
python -m pip install korail-py-SDK
|
|
35
|
+
# Optional SOCKS proxy support:
|
|
36
|
+
python -m pip install 'korail-py-SDK[socks]'
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The Python import name is `korail_py_sdk`.
|
|
40
|
+
|
|
41
|
+
## Search example
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from korail_py_sdk import KorailClient, TrainSearchQuery
|
|
45
|
+
|
|
46
|
+
with KorailClient() as client:
|
|
47
|
+
response = client.search_trains(TrainSearchQuery("서울", "부산", "20991230", "090000"))
|
|
48
|
+
for train in response.trains:
|
|
49
|
+
print(train.train_no, train.departure_time)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Replace the example date with a valid travel date. Executing this example sends a real schedule request; automated tests do not execute it.
|
|
53
|
+
|
|
54
|
+
## Behavior that matters
|
|
55
|
+
|
|
56
|
+
- Every search obtains a fresh response; seat availability and transaction outcomes are never cached.
|
|
57
|
+
- Transaction requests are never retried automatically. Check uncertain outcomes through official channels before trying again.
|
|
58
|
+
- The default software declaration profile replaces diagnostic-only tokens; ordinary single-train reservations use the observed GET/query profile. See [configuration and validation limits](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/getting-started.md).
|
|
59
|
+
- Decode failures retain the whole response in `error.raw`, with nested context in `error.parser_raw` when available. Treat both as potentially sensitive.
|
|
60
|
+
- Pagination detects repeated pages and preserves continuation metadata.
|
|
61
|
+
- Business rejection, malformed responses, session expiry and protocol-access rejection remain distinct.
|
|
62
|
+
- HTTP cookies have one owner; curl responses are adapted without a second decompression pass. Credential and payment fields are hidden from generated model representations.
|
|
63
|
+
|
|
64
|
+
## Maintenance and recovery
|
|
65
|
+
|
|
66
|
+
Explicit maintenance/rate-limit responses (including HTTP 429/503) block subsequent requests to the same configured API origin. Two consecutive transport failures also open a cooldown. Defaults are 30 minutes, 1 hour, 2 hours, then 4 hours, plus up to 10% positive jitter; a longer server `Retry-After` takes precedence. Errors expose `status_code`, `retry_after` (seconds) and `next_probe_at` (UTC Unix timestamp) when available. Invalid `strResult` values raise `KorailProtocolError` and retain `raw`.
|
|
67
|
+
|
|
68
|
+
During cooldown, login, queue admission and ordinary API calls fail locally. Once the deadline passes, only a caller-requested `get_service_status()` may probe recovery, and only one probe can run at a time. A successful status response permits ordinary calls again; it does not prove that every login or transaction endpoint is healthy. The library starts no timer, worker or background traffic. Applications should schedule one status check at `next_probe_at` only while work is pending, then resume reads gradually. Never replay an ambiguous reservation/payment automatically.
|
|
69
|
+
|
|
70
|
+
For a single-process application, use the default in-memory policy with no database configuration. Clients in that process share cooldowns and recovery-probe exclusion. Restarting the process clears this state, so the next call may contact the server again.
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from korail_py_sdk import KorailApiError, KorailClient
|
|
74
|
+
|
|
75
|
+
with KorailClient() as client:
|
|
76
|
+
try:
|
|
77
|
+
status = client.get_service_status()
|
|
78
|
+
except KorailApiError as error:
|
|
79
|
+
if error.next_probe_at is None:
|
|
80
|
+
raise
|
|
81
|
+
next_check_at = error.next_probe_at # Schedule; do not loop immediately.
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
SQLite remains an optional advanced setting for restart persistence or multiple processes: create a `MaintenancePolicy(state_path="/app/data/korail-maintenance.sqlite3")` from `korail_py_sdk.maintenance` and pass it as `KorailClient(maintenance=policy)`. The parent directory must already exist on a local filesystem. The database stores only origins, counters, deadlines and probe leases, without credentials or response bodies; separate hosts need application-level coordination. Set `probe_lease` longer than your longest possible status request when customizing timeouts beyond the default 5-minute lease. Separate policy objects without `state_path` have independent state.
|
|
85
|
+
|
|
86
|
+
Queue transport errors no longer bypass admission to send the API request. Error retries check the remaining queue budget before sleeping or sending again, and there is no sleep after the final failure. Queue admission has a 300-second default budget; explicitly setting `KorailConfig(netfunnel_wait_limit=None)` restores unlimited normal queue waiting. The budget does not cancel an already-running HTTP request or delay token cleanup.
|
|
87
|
+
|
|
88
|
+
These are deliberate behavior corrections: `raise_on_fail=False` cannot bypass maintenance/rate-limit protection, and malformed result envelopes are rejected before later steps in a transaction. Account errors, application-update requirements and protocol-access rejections alone do not establish maintenance.
|
|
89
|
+
|
|
90
|
+
## Architecture
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
src/
|
|
94
|
+
└── korail_py_sdk/
|
|
95
|
+
├── api/ Public client and convenience resources
|
|
96
|
+
├── services/ Authentication, search and transaction rules
|
|
97
|
+
├── protocol/ Request compilation and response decoding
|
|
98
|
+
├── transport/ HTTP, curl adaptation and queue admission
|
|
99
|
+
├── models/ Value objects, exceptions and type declarations
|
|
100
|
+
├── configuration/ Device and environment settings
|
|
101
|
+
├── security/ Password transformation and token serialization
|
|
102
|
+
├── messages/ Localized message lookup
|
|
103
|
+
└── resources/ Protocol contracts and vendor message data
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
See [ARCHITECTURE.md](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/ARCHITECTURE.md) for ownership boundaries and locations for behavioral changes. The package builds and runs from this repository.
|
|
107
|
+
|
|
108
|
+
## Validation and performance
|
|
109
|
+
|
|
110
|
+
The test suite and decoder comparisons use synthetic data. See [VALIDATION.md](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/VALIDATION.md) for the checks and their limits.
|
|
111
|
+
|
|
112
|
+
Offline benchmarks exercise mock transports and do not establish real KORAIL request latency or acceptance.
|
|
113
|
+
|
|
114
|
+
## Development
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
.venv/bin/python -m pip install -e '.[dev]'
|
|
118
|
+
.venv/bin/python -m pytest
|
|
119
|
+
.venv/bin/ruff check .
|
|
120
|
+
.venv/bin/ruff format --check .
|
|
121
|
+
.venv/bin/mypy
|
|
122
|
+
.venv/bin/python -m build
|
|
123
|
+
.venv/bin/python -m twine check dist/*
|
|
124
|
+
.venv/bin/python tools/packaging/check_artifacts.py dist/*.whl --sdist dist/*.tar.gz
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Tests block network traffic and use synthetic data. See [CONTRIBUTING.md](https://github.com/sontheo/KORAIL-py-SDK/blob/main/.github/CONTRIBUTING.md) for repository-only checks, documentation builds and packaging boundaries. Do not include credentials, passenger data, payment details or unredacted responses in issues.
|
|
128
|
+
|
|
129
|
+
## License and provenance
|
|
130
|
+
|
|
131
|
+
The maintainer-authored software is offered under [Apache-2.0](https://github.com/sontheo/KORAIL-py-SDK/blob/main/LICENSE), subject to the scope and notices in [LEGAL.md](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/LEGAL.md), [NOTICE](https://github.com/sontheo/KORAIL-py-SDK/blob/main/NOTICE) and [THIRD_PARTY_NOTICES.md](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/THIRD_PARTY_NOTICES.md).
|
|
132
|
+
|
|
133
|
+
Material provenance is recorded in [PROVENANCE.md](https://github.com/sontheo/KORAIL-py-SDK/blob/main/docs/PROVENANCE.md). Third-party data, runtime dependencies, trademarks and service-access permissions retain their respective rights. No live login, reservation, cancellation, payment or refund has been used to validate this release.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Source layout
|
|
2
|
+
|
|
3
|
+
The distribution exposes a single public namespace, `korail_py_sdk`. Its modules separate the API, protocol, transport, services and models.
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
KORAIL-py-SDK/
|
|
7
|
+
├── src/
|
|
8
|
+
│ └── korail_py_sdk/
|
|
9
|
+
│ ├── api/ # Public client, facade, type attachment
|
|
10
|
+
│ ├── configuration/ # Device and environment configuration
|
|
11
|
+
│ ├── models/ # Value objects and exception hierarchy
|
|
12
|
+
│ ├── services/
|
|
13
|
+
│ │ ├── authentication.py
|
|
14
|
+
│ │ ├── search.py
|
|
15
|
+
│ │ ├── reservations.py
|
|
16
|
+
│ │ ├── compatibility.py # Observed ordinary reservation wire profile
|
|
17
|
+
│ │ ├── payments.py
|
|
18
|
+
│ │ ├── validation.py
|
|
19
|
+
│ │ └── operations.py # Operation orchestration and remaining read rules
|
|
20
|
+
│ ├── protocol/ # Request compilation, decoding, adapters, data loading
|
|
21
|
+
│ ├── transport/ # HTTP, curl adaptation, admission, cleanup
|
|
22
|
+
│ ├── security/ # Password transformation and token serialization
|
|
23
|
+
│ ├── messages/ # Locale and display text handling
|
|
24
|
+
│ └── resources/
|
|
25
|
+
│ ├── contracts/ # Interface and wire contract data
|
|
26
|
+
│ └── messages/ # Vendor messages and provenance
|
|
27
|
+
├── tests/
|
|
28
|
+
│ ├── fixtures/ # Synthetic wire and mutation cases
|
|
29
|
+
│ └── *.py # Offline behavior and typing checks
|
|
30
|
+
├── tools/
|
|
31
|
+
│ ├── packaging/ # Isolated wheel and source-archive verification
|
|
32
|
+
│ ├── catalog/ # Vendor resource importer; explicit input only
|
|
33
|
+
│ ├── validation/ # Captured synthetic decoder comparisons
|
|
34
|
+
│ ├── performance/ # Equivalent benchmarks and profiling
|
|
35
|
+
├── docs/ # Current documentation site
|
|
36
|
+
└── .github/ # CI and contribution guidance
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The wheel contains the runtime namespace and release documentation. The source archive also contains the standalone tests, artifact checker and catalog importer. Captured decoder outcomes, validators, performance tools and reports are development-only.
|
|
40
|
+
|
|
41
|
+
## Where to change behavior
|
|
42
|
+
|
|
43
|
+
- Authentication and session transitions: `services/authentication.py`.
|
|
44
|
+
- Search validation and continuation values: `services/search.py`; client pagination is in `api/client.py`.
|
|
45
|
+
- Passenger, journey, designated-seat and limousine reservation rules: `services/reservations.py`.
|
|
46
|
+
- Declaration-provider ordinary reservation selection and query fields: `services/compatibility.py`; token serialization: `security/declaration.py`.
|
|
47
|
+
- Card and settlement validation: `services/payments.py`.
|
|
48
|
+
- Remaining account/product query rules and operation orchestration: `services/operations.py`.
|
|
49
|
+
- Wire field mappings: `resources/contracts/requests.json`; their compilation and fresh per-call forms: `protocol/requests.py`.
|
|
50
|
+
- Response field conversion and raw error context: `protocol/codec.py`.
|
|
51
|
+
- HTTP status, cookies, form encoding and protocol rejection: `transport/http.py`.
|
|
52
|
+
- Already-decompressed curl responses and proxy handling: `transport/curl.py`.
|
|
53
|
+
- Queue admission, budgets and completion: `transport/admission.py`.
|
|
54
|
+
- Public constructor fields and signatures: `resources/contracts/public-interface.json`; model construction in `models/records.py`, concrete method annotations in `api/annotations.py`, and declarations in colocated `.pyi` files.
|
|
55
|
+
|
|
56
|
+
`services/operations.py` and the schema-driven model/decoder engines remain shared components. This reorganization establishes their ownership; it does not claim that every operation has already been converted into a separately authored explicit handler.
|
|
57
|
+
|
|
58
|
+
## Cache boundaries
|
|
59
|
+
|
|
60
|
+
Field interpretation plans, immutable date-validation results and resolved endpoint URL objects are cached. Every request receives a fresh form dictionary; client configuration, session values, current timestamps and query arguments are read on each call. Search responses, availability, queue passes and transaction outcomes are never cached by these optimizations. The form-plan cache is bounded to 512 entries the date-validation cache to 1,024 entries, and the per-client endpoint cache to 256 entries. Endpoint resolution is invalidated when the base URL changes and bypassed for client-level query defaults. Cookies, tokens and query/body values remain current on every request.
|
|
61
|
+
|
|
62
|
+
The offline contract suite remains the compatibility boundary when moving responsibilities into smaller handlers. Run it after changing a request rule, raw-response conversion or gate policy.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.1 — 2026-11-19
|
|
4
|
+
|
|
5
|
+
- Rename the distribution to `korail-py-SDK` and its import namespace to `korail_py_sdk`.
|
|
6
|
+
- Streamline response decoding, request field ordering and model default construction.
|
|
7
|
+
|
|
8
|
+
- Classify DynaPath `-8004` and `macro_err1` consistently before HTTP/business errors, preserve structured diagnostic metadata, and distinguish network-policy guidance without automatic retries or claims about specific detection triggers.
|
|
9
|
+
- Default to software declaration tokens with fresh request timestamps/nonces and a configuration-scoped synthetic identity; retain explicit diagnostic/legacy modes and external signers.
|
|
10
|
+
- Align ordinary immediate reservations without designated seats with the observed GET/query profile, default wire version, blank fields and passenger ordering. Preserve explicit versions and other reservation formats.
|
|
11
|
+
- Verify the codec against recorded emulator output digests and complete ordinary-reservation queries against independently intercepted synthetic reference requests. No live transaction was executed, and no transaction retry or protocol fallback was added.
|
|
12
|
+
|
|
13
|
+
## 0.1.0 — 2026-10-23
|
|
14
|
+
|
|
15
|
+
- Reject invalid result envelopes and prevent queue error retries from exceeding the admission budget.
|
|
16
|
+
- Add shared in-memory maintenance cooldowns, server retry metadata, single recovery probes and optional SQLite persistence.
|
|
17
|
+
- Stop queue error bypass and final-failure sleeps; bound queue admission to 300 seconds by default (explicit `None` remains unlimited).
|
|
18
|
+
|
|
19
|
+
- Publish the current implementation in the new `korail-api_v2` repository, with a new Git history.
|
|
20
|
+
- Expose 239 public exports, 86 client methods and typed model/request contracts.
|
|
21
|
+
- Separate protocol, transport, service, configuration, model, message and security responsibilities.
|
|
22
|
+
- Retain tested failure context, queue behavior, error distinctions and transaction protections.
|
|
23
|
+
- Reuse resolved endpoint URLs and simplify common-envelope decoding; see [`docs/VALIDATION.md`](VALIDATION.md) for offline checks and limits.
|
|
24
|
+
- Include standalone tests, typed public declarations, isolated artifact verification and CI.
|
|
25
|
+
- Keep runtime annotation installation compatible with Python 3.14's unified union types.
|
|
26
|
+
- Add English documentation, original banner artwork and explicit legal/provenance notices.
|
|
27
|
+
|
|
28
|
+
GitHub release `v0.1.0` includes the wheel and source archive. That release used the earlier `korail-api` distribution name. Offline validation and live-service validation are distinct; this release has no live authentication or transaction acceptance claim.
|