weiche 0.9.1.dev1__tar.gz → 0.10.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.
- {weiche-0.9.1.dev1 → weiche-0.10.1}/.github/workflows/ci.yml +3 -5
- {weiche-0.9.1.dev1 → weiche-0.10.1}/.gitignore +1 -0
- weiche-0.10.1/.mdlrc +7 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/PKG-INFO +33 -5
- {weiche-0.9.1.dev1 → weiche-0.10.1}/README.md +32 -4
- {weiche-0.9.1.dev1 → weiche-0.10.1}/pyproject.toml +4 -9
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/weiche/api/asynchronous.py +28 -12
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/weiche/api/synchronous.py +27 -11
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/weiche/objects.py +1 -2
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/weiche/schiene.py +8 -6
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/weiche/version.py +2 -2
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/weiche.egg-info/PKG-INFO +33 -5
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/weiche.egg-info/SOURCES.txt +1 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/.coveragerc +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/.flake8 +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/.pre-commit-config.yaml +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/LICENSE +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/MANIFEST.in +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/setup.cfg +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/py.typed +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/weiche/__init__.py +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/weiche/api/__init__.py +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/weiche/api/base.py +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/weiche/api/parser.py +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/weiche/const.py +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/weiche/formatter.py +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/weiche/tests/__init__.py +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/weiche/tests/test_asynchronous.py +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/weiche/tests/test_schiene.py +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/weiche/tests/test_synchronous.py +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/weiche.egg-info/dependency_links.txt +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/weiche.egg-info/requires.txt +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/src/weiche.egg-info/top_level.txt +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/tox.ini +0 -0
- {weiche-0.9.1.dev1 → weiche-0.10.1}/utils/pre-commit +0 -0
|
@@ -6,7 +6,7 @@ jobs:
|
|
|
6
6
|
runs-on: ubuntu-latest
|
|
7
7
|
strategy:
|
|
8
8
|
matrix:
|
|
9
|
-
python-version: ['3.11']
|
|
9
|
+
python-version: ['3.10', '3.11', '3.12', '3.13']
|
|
10
10
|
steps:
|
|
11
11
|
- uses: actions/checkout@v3
|
|
12
12
|
- uses: actions/setup-python@v4.5.0
|
|
@@ -15,8 +15,8 @@ jobs:
|
|
|
15
15
|
- name: Install dependencies
|
|
16
16
|
run: |
|
|
17
17
|
python -m pip install --upgrade pip
|
|
18
|
-
python -m pip install --use-pep517 pytest-cov pytest-random pytest-remove-stale-bytecode flake8 pycodestyle pydocstyle
|
|
19
|
-
python -m pip install .
|
|
18
|
+
python -m pip install --use-pep517 pytest-cov pytest-random pytest-remove-stale-bytecode flake8 pycodestyle pydocstyle
|
|
19
|
+
python -m pip install .[test]
|
|
20
20
|
- name: Run unittest
|
|
21
21
|
run: pytest -v --random --cov=src/weiche --cov-report=term
|
|
22
22
|
- name: flake8
|
|
@@ -25,5 +25,3 @@ jobs:
|
|
|
25
25
|
run: pycodestyle -v --first src
|
|
26
26
|
- name: pydocstyle
|
|
27
27
|
run: pydocstyle -v --match='(?!test_|version)(.*)?\.py' src
|
|
28
|
-
- name: build docs
|
|
29
|
-
run: sphinx-build -M html docs/source doc/build
|
weiche-0.10.1/.mdlrc
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Auto-generated from https://github.com/xcnt/xcnt-gardener/blob/main/templates/common/.mdlrc
|
|
2
|
+
|
|
3
|
+
# See set of available rules here: https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md
|
|
4
|
+
rules "MD001", "MD002", "MD003", "MD009", "MD012", "MD018", "MD019", "MD022", "MD023", "MD025", "MD026", "MD041", "MD047"
|
|
5
|
+
|
|
6
|
+
# header style
|
|
7
|
+
rule "MD003", :style => atx
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: weiche
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10.1
|
|
4
4
|
Summary: A wrapper around the DB Website API for querying train connections.
|
|
5
5
|
Author-email: Christoph Brand <christoph+pypi@brand.rest>
|
|
6
6
|
License: MIT License
|
|
@@ -109,12 +109,22 @@ api.search_connections(
|
|
|
109
109
|
)
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
+
You can also add an HTTP proxy to connect via as Bahn tends to block server ip addresses.
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from weiche import SynchronousApi
|
|
116
|
+
|
|
117
|
+
api = SynchronousApi(proxy="192.168.0.1:8888")
|
|
118
|
+
```
|
|
119
|
+
|
|
112
120
|
<details>
|
|
113
121
|
<summary>Response from Synchronous API</summary>
|
|
114
122
|
|
|
115
|
-
The return format is an object which can also be found in the
|
|
123
|
+
The return format is an object which can also be found in the
|
|
124
|
+
[objects.py](./src/weiche/objects.py) file.
|
|
116
125
|
|
|
117
|
-
Look for the [`Connection`](./src/weiche/objects.py#L175) class
|
|
126
|
+
Look for the [`Connection`](./src/weiche/objects.py#L175) class
|
|
127
|
+
and see the API definition there.
|
|
118
128
|
|
|
119
129
|
</details>
|
|
120
130
|
|
|
@@ -143,12 +153,22 @@ async def search():
|
|
|
143
153
|
asyncio.get_event_loop().run_until_complete(search())
|
|
144
154
|
```
|
|
145
155
|
|
|
156
|
+
You can also add an HTTP proxy to connect via as Bahn tends to block server ip addresses.
|
|
157
|
+
|
|
158
|
+
```python
|
|
159
|
+
from weiche import AsynchronousApi
|
|
160
|
+
|
|
161
|
+
api = AsynchronousApi(proxy="192.168.0.1:8888")
|
|
162
|
+
```
|
|
163
|
+
|
|
146
164
|
<details>
|
|
147
165
|
<summary>Response from Asynchronous API</summary>
|
|
148
166
|
|
|
149
|
-
The return format is an object which can also be found in the
|
|
167
|
+
The return format is an object which can also be found in the
|
|
168
|
+
[objects.py](./src/weiche/objects.py) file.
|
|
150
169
|
|
|
151
|
-
Look for the [`Connection`](./src/weiche/objects.py#L175)
|
|
170
|
+
Look for the [`Connection`](./src/weiche/objects.py#L175)
|
|
171
|
+
class and see the API definition there.
|
|
152
172
|
|
|
153
173
|
</details>
|
|
154
174
|
|
|
@@ -160,6 +180,14 @@ from weiche import Schiene
|
|
|
160
180
|
Schiene().connections('Mannheim HbF', 'Stuttgart HbF')
|
|
161
181
|
```
|
|
162
182
|
|
|
183
|
+
You can also add an HTTP proxy to connect via as Bahn tends to block server ip addresses.
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
from weiche import Schiene
|
|
187
|
+
|
|
188
|
+
api = Schiene(proxy="192.168.0.1:8888")
|
|
189
|
+
```
|
|
190
|
+
|
|
163
191
|
<details>
|
|
164
192
|
<summary>Response from Schiene Layer</summary>
|
|
165
193
|
|
|
@@ -53,12 +53,22 @@ api.search_connections(
|
|
|
53
53
|
)
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
You can also add an HTTP proxy to connect via as Bahn tends to block server ip addresses.
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from weiche import SynchronousApi
|
|
60
|
+
|
|
61
|
+
api = SynchronousApi(proxy="192.168.0.1:8888")
|
|
62
|
+
```
|
|
63
|
+
|
|
56
64
|
<details>
|
|
57
65
|
<summary>Response from Synchronous API</summary>
|
|
58
66
|
|
|
59
|
-
The return format is an object which can also be found in the
|
|
67
|
+
The return format is an object which can also be found in the
|
|
68
|
+
[objects.py](./src/weiche/objects.py) file.
|
|
60
69
|
|
|
61
|
-
Look for the [`Connection`](./src/weiche/objects.py#L175) class
|
|
70
|
+
Look for the [`Connection`](./src/weiche/objects.py#L175) class
|
|
71
|
+
and see the API definition there.
|
|
62
72
|
|
|
63
73
|
</details>
|
|
64
74
|
|
|
@@ -87,12 +97,22 @@ async def search():
|
|
|
87
97
|
asyncio.get_event_loop().run_until_complete(search())
|
|
88
98
|
```
|
|
89
99
|
|
|
100
|
+
You can also add an HTTP proxy to connect via as Bahn tends to block server ip addresses.
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
from weiche import AsynchronousApi
|
|
104
|
+
|
|
105
|
+
api = AsynchronousApi(proxy="192.168.0.1:8888")
|
|
106
|
+
```
|
|
107
|
+
|
|
90
108
|
<details>
|
|
91
109
|
<summary>Response from Asynchronous API</summary>
|
|
92
110
|
|
|
93
|
-
The return format is an object which can also be found in the
|
|
111
|
+
The return format is an object which can also be found in the
|
|
112
|
+
[objects.py](./src/weiche/objects.py) file.
|
|
94
113
|
|
|
95
|
-
Look for the [`Connection`](./src/weiche/objects.py#L175)
|
|
114
|
+
Look for the [`Connection`](./src/weiche/objects.py#L175)
|
|
115
|
+
class and see the API definition there.
|
|
96
116
|
|
|
97
117
|
</details>
|
|
98
118
|
|
|
@@ -104,6 +124,14 @@ from weiche import Schiene
|
|
|
104
124
|
Schiene().connections('Mannheim HbF', 'Stuttgart HbF')
|
|
105
125
|
```
|
|
106
126
|
|
|
127
|
+
You can also add an HTTP proxy to connect via as Bahn tends to block server ip addresses.
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
from weiche import Schiene
|
|
131
|
+
|
|
132
|
+
api = Schiene(proxy="192.168.0.1:8888")
|
|
133
|
+
```
|
|
134
|
+
|
|
107
135
|
<details>
|
|
108
136
|
<summary>Response from Schiene Layer</summary>
|
|
109
137
|
|
|
@@ -32,13 +32,8 @@ dynamic = ['version']
|
|
|
32
32
|
[tools.setuptools]
|
|
33
33
|
package-dir = {'' = 'src'}
|
|
34
34
|
|
|
35
|
-
[
|
|
36
|
-
version = {attr =
|
|
37
|
-
|
|
38
|
-
[tool.setuptools_scm]
|
|
39
|
-
write_to = 'src/weiche/version.py'
|
|
40
|
-
version_scheme = 'python-simplified-semver'
|
|
41
|
-
local_scheme = 'no-local-version'
|
|
35
|
+
[tool.setuptools.dynamic]
|
|
36
|
+
version = { attr = "setuptools_scm.get_version" }
|
|
42
37
|
|
|
43
38
|
[project.urls]
|
|
44
39
|
'Homepage' = 'https://github.com/cbrand/weiche'
|
|
@@ -68,10 +63,10 @@ force_grid_wrap=0
|
|
|
68
63
|
known_first_party="xcnt"
|
|
69
64
|
|
|
70
65
|
[tool.semantic_release]
|
|
71
|
-
version_variables = ["
|
|
66
|
+
version_variables = ["src/weiche/version.py:__version__"]
|
|
72
67
|
commit_message = "{version}\n\nAutomatically generated by python-semantic-release"
|
|
73
68
|
commit_parser = "angular"
|
|
74
|
-
build_command = "python
|
|
69
|
+
build_command = "python -m build --sdist --wheel ."
|
|
75
70
|
|
|
76
71
|
[tool.semantic_release.branches.main]
|
|
77
72
|
match = "(main|master)"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
2
|
from http import HTTPStatus
|
|
3
|
+
import asyncio
|
|
3
4
|
|
|
4
5
|
import aiohttp
|
|
5
6
|
|
|
@@ -10,9 +11,10 @@ from weiche.objects import Association, Connection, ConnectionRequest, Location
|
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
class AsynchronousApi(BaseApi):
|
|
13
|
-
def __init__(self, base_url: str = DEFAULT_BASE_URL):
|
|
14
|
+
def __init__(self, base_url: str = DEFAULT_BASE_URL, proxy: str | None = None) -> None:
|
|
14
15
|
super().__init__(base_url)
|
|
15
|
-
|
|
16
|
+
proxy = proxy or None
|
|
17
|
+
self.session = aiohttp.ClientSession(proxy=proxy)
|
|
16
18
|
|
|
17
19
|
async def get_travel_associations(self) -> list[Association]:
|
|
18
20
|
async with self.session.get(self.travel_associations_url) as response:
|
|
@@ -20,16 +22,23 @@ class AsynchronousApi(BaseApi):
|
|
|
20
22
|
return parse_associations(await response.json())
|
|
21
23
|
|
|
22
24
|
async def search_locations(self, query: str, limit: int = 10, location_type: str = "ALL") -> list[Location]:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
tries = 0
|
|
26
|
+
while True:
|
|
27
|
+
async with self.session.get(
|
|
28
|
+
self.locations_url,
|
|
29
|
+
params=self.get_locations_params(
|
|
30
|
+
query=query,
|
|
31
|
+
limit=limit,
|
|
32
|
+
location_type=location_type,
|
|
33
|
+
),
|
|
34
|
+
) as response:
|
|
35
|
+
if response.status == HTTPStatus.TOO_MANY_REQUESTS:
|
|
36
|
+
tries += 1
|
|
37
|
+
await asyncio.sleep(tries)
|
|
38
|
+
continue
|
|
39
|
+
|
|
40
|
+
assert response.status == HTTPStatus.OK, f"Error: {response.status}"
|
|
41
|
+
return parse_locations(await response.json())
|
|
33
42
|
|
|
34
43
|
async def search_connections(
|
|
35
44
|
self,
|
|
@@ -45,12 +54,19 @@ class AsynchronousApi(BaseApi):
|
|
|
45
54
|
|
|
46
55
|
async def search_connections_ext(self, request: ConnectionRequest, limit: int = 10) -> list[Connection]:
|
|
47
56
|
responses: list[Connection] = []
|
|
57
|
+
tries = 0
|
|
48
58
|
while len(responses) < limit:
|
|
49
59
|
request_params = self.get_connections_ext_params(request)
|
|
50
60
|
async with self.session.post(
|
|
51
61
|
self.connections_url,
|
|
52
62
|
json=request_params,
|
|
53
63
|
) as response:
|
|
64
|
+
if response.status == HTTPStatus.TOO_MANY_REQUESTS:
|
|
65
|
+
tries += 1
|
|
66
|
+
await asyncio.sleep(tries)
|
|
67
|
+
continue
|
|
68
|
+
tries = 0
|
|
69
|
+
|
|
54
70
|
assert response.status in (
|
|
55
71
|
HTTPStatus.OK,
|
|
56
72
|
HTTPStatus.CREATED,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
2
|
from http import HTTPStatus
|
|
3
3
|
|
|
4
|
+
import time
|
|
4
5
|
import requests
|
|
5
6
|
|
|
6
7
|
from weiche.api.base import BaseApi
|
|
@@ -10,9 +11,11 @@ from weiche.objects import Association, Connection, ConnectionRequest, Location
|
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
class SynchronousApi(BaseApi):
|
|
13
|
-
def __init__(self, base_url: str = DEFAULT_BASE_URL):
|
|
14
|
+
def __init__(self, base_url: str = DEFAULT_BASE_URL, proxy: str | None = None) -> None:
|
|
14
15
|
super().__init__(base_url)
|
|
15
16
|
self.session = requests.Session()
|
|
17
|
+
if proxy:
|
|
18
|
+
self.session.proxies = {"http": proxy, "https": proxy}
|
|
16
19
|
|
|
17
20
|
def get_travel_associations(self) -> list[Association]:
|
|
18
21
|
response = self.session.get(self.travel_associations_url)
|
|
@@ -20,16 +23,22 @@ class SynchronousApi(BaseApi):
|
|
|
20
23
|
return parse_associations(response.json())
|
|
21
24
|
|
|
22
25
|
def search_locations(self, query: str, limit: int = 10, location_type: str = "ALL") -> list[Location]:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
tries = 0
|
|
27
|
+
while True:
|
|
28
|
+
tries += 1
|
|
29
|
+
response = self.session.get(
|
|
30
|
+
self.locations_url,
|
|
31
|
+
params=self.get_locations_params(
|
|
32
|
+
query=query,
|
|
33
|
+
limit=limit,
|
|
34
|
+
location_type=location_type,
|
|
35
|
+
),
|
|
36
|
+
)
|
|
37
|
+
if response.status_code == HTTPStatus.TOO_MANY_REQUESTS:
|
|
38
|
+
time.sleep(tries)
|
|
39
|
+
continue
|
|
40
|
+
assert response.status_code == HTTPStatus.OK, f"Error: {response.status_code}"
|
|
41
|
+
return parse_locations(response.json())
|
|
33
42
|
|
|
34
43
|
def search_connections(
|
|
35
44
|
self,
|
|
@@ -45,12 +54,19 @@ class SynchronousApi(BaseApi):
|
|
|
45
54
|
|
|
46
55
|
def search_connections_ext(self, request: ConnectionRequest, limit: int = 10) -> list[Connection]:
|
|
47
56
|
responses: list[Connection] = []
|
|
57
|
+
tries = 0
|
|
48
58
|
while len(responses) < limit:
|
|
49
59
|
request_params = self.get_connections_ext_params(request)
|
|
50
60
|
response = self.session.post(
|
|
51
61
|
self.connections_url,
|
|
52
62
|
json=request_params,
|
|
53
63
|
)
|
|
64
|
+
if response.status_code == HTTPStatus.TOO_MANY_REQUESTS:
|
|
65
|
+
tries += 1
|
|
66
|
+
time.sleep(tries)
|
|
67
|
+
continue
|
|
68
|
+
tries = 0
|
|
69
|
+
|
|
54
70
|
assert response.status_code in (
|
|
55
71
|
HTTPStatus.OK,
|
|
56
72
|
HTTPStatus.CREATED,
|
|
@@ -27,7 +27,6 @@ class SchieneConnection(TypedDict):
|
|
|
27
27
|
arrival: str
|
|
28
28
|
canceled: bool
|
|
29
29
|
departure: str
|
|
30
|
-
delay: SchieneConnectionDelay | None
|
|
31
30
|
details: str
|
|
32
31
|
price: float | None
|
|
33
32
|
products: list[str]
|
|
@@ -36,13 +35,17 @@ class SchieneConnection(TypedDict):
|
|
|
36
35
|
ontime: bool
|
|
37
36
|
|
|
38
37
|
|
|
38
|
+
class DelayedSchieneConnection(SchieneConnection):
|
|
39
|
+
delay: SchieneConnectionDelay
|
|
40
|
+
|
|
41
|
+
|
|
39
42
|
def datetime_to_time_string(dt: datetime | None) -> str:
|
|
40
43
|
if dt is None:
|
|
41
44
|
return ""
|
|
42
45
|
return dt.strftime("%H:%M")
|
|
43
46
|
|
|
44
47
|
|
|
45
|
-
def connection_to_dict(connection: Connection) -> SchieneConnection:
|
|
48
|
+
def connection_to_dict(connection: Connection) -> SchieneConnection | DelayedSchieneConnection:
|
|
46
49
|
if connection.price is None:
|
|
47
50
|
amount = None
|
|
48
51
|
else:
|
|
@@ -62,7 +65,6 @@ def connection_to_dict(connection: Connection) -> SchieneConnection:
|
|
|
62
65
|
time=connection.ez_connection_time_string or connection.connection_time_string,
|
|
63
66
|
transfers=connection.changes,
|
|
64
67
|
ontime=connection.on_time,
|
|
65
|
-
delay=None,
|
|
66
68
|
)
|
|
67
69
|
if not connection.on_time:
|
|
68
70
|
payload["delay"] = SchieneConnectionDelay(
|
|
@@ -88,8 +90,8 @@ def schiene_to_dict(location: Location, index: int) -> SchieneStation:
|
|
|
88
90
|
|
|
89
91
|
|
|
90
92
|
class Schiene:
|
|
91
|
-
def __init__(self):
|
|
92
|
-
self.api = SynchronousApi()
|
|
93
|
+
def __init__(self, proxy: str | None = None) -> None:
|
|
94
|
+
self.api = SynchronousApi(proxy=proxy)
|
|
93
95
|
|
|
94
96
|
def stations(self, station: str, limit: int = 10) -> list[SchieneStation]:
|
|
95
97
|
"""Find stations for given queries.
|
|
@@ -106,7 +108,7 @@ class Schiene:
|
|
|
106
108
|
|
|
107
109
|
def connections(
|
|
108
110
|
self, origin: str, destination: str, dt: datetime = datetime.now(), only_direct: bool = False
|
|
109
|
-
) -> list[SchieneConnection]:
|
|
111
|
+
) -> list[SchieneConnection | DelayedSchieneConnection]:
|
|
110
112
|
"""Find connections between two stations.
|
|
111
113
|
|
|
112
114
|
Args:
|
|
@@ -17,5 +17,5 @@ __version__: str
|
|
|
17
17
|
__version_tuple__: VERSION_TUPLE
|
|
18
18
|
version_tuple: VERSION_TUPLE
|
|
19
19
|
|
|
20
|
-
__version__ = version = '0.9.
|
|
21
|
-
__version_tuple__ = version_tuple = (0, 9,
|
|
20
|
+
__version__ = version = '0.9.2.dev0'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 9, 2, 'dev0')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: weiche
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10.1
|
|
4
4
|
Summary: A wrapper around the DB Website API for querying train connections.
|
|
5
5
|
Author-email: Christoph Brand <christoph+pypi@brand.rest>
|
|
6
6
|
License: MIT License
|
|
@@ -109,12 +109,22 @@ api.search_connections(
|
|
|
109
109
|
)
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
+
You can also add an HTTP proxy to connect via as Bahn tends to block server ip addresses.
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from weiche import SynchronousApi
|
|
116
|
+
|
|
117
|
+
api = SynchronousApi(proxy="192.168.0.1:8888")
|
|
118
|
+
```
|
|
119
|
+
|
|
112
120
|
<details>
|
|
113
121
|
<summary>Response from Synchronous API</summary>
|
|
114
122
|
|
|
115
|
-
The return format is an object which can also be found in the
|
|
123
|
+
The return format is an object which can also be found in the
|
|
124
|
+
[objects.py](./src/weiche/objects.py) file.
|
|
116
125
|
|
|
117
|
-
Look for the [`Connection`](./src/weiche/objects.py#L175) class
|
|
126
|
+
Look for the [`Connection`](./src/weiche/objects.py#L175) class
|
|
127
|
+
and see the API definition there.
|
|
118
128
|
|
|
119
129
|
</details>
|
|
120
130
|
|
|
@@ -143,12 +153,22 @@ async def search():
|
|
|
143
153
|
asyncio.get_event_loop().run_until_complete(search())
|
|
144
154
|
```
|
|
145
155
|
|
|
156
|
+
You can also add an HTTP proxy to connect via as Bahn tends to block server ip addresses.
|
|
157
|
+
|
|
158
|
+
```python
|
|
159
|
+
from weiche import AsynchronousApi
|
|
160
|
+
|
|
161
|
+
api = AsynchronousApi(proxy="192.168.0.1:8888")
|
|
162
|
+
```
|
|
163
|
+
|
|
146
164
|
<details>
|
|
147
165
|
<summary>Response from Asynchronous API</summary>
|
|
148
166
|
|
|
149
|
-
The return format is an object which can also be found in the
|
|
167
|
+
The return format is an object which can also be found in the
|
|
168
|
+
[objects.py](./src/weiche/objects.py) file.
|
|
150
169
|
|
|
151
|
-
Look for the [`Connection`](./src/weiche/objects.py#L175)
|
|
170
|
+
Look for the [`Connection`](./src/weiche/objects.py#L175)
|
|
171
|
+
class and see the API definition there.
|
|
152
172
|
|
|
153
173
|
</details>
|
|
154
174
|
|
|
@@ -160,6 +180,14 @@ from weiche import Schiene
|
|
|
160
180
|
Schiene().connections('Mannheim HbF', 'Stuttgart HbF')
|
|
161
181
|
```
|
|
162
182
|
|
|
183
|
+
You can also add an HTTP proxy to connect via as Bahn tends to block server ip addresses.
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
from weiche import Schiene
|
|
187
|
+
|
|
188
|
+
api = Schiene(proxy="192.168.0.1:8888")
|
|
189
|
+
```
|
|
190
|
+
|
|
163
191
|
<details>
|
|
164
192
|
<summary>Response from Schiene Layer</summary>
|
|
165
193
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|