MBTAclient 0.2.2__tar.gz → 0.2.4__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.
- {mbtaclient-0.2.2 → mbtaclient-0.2.4}/PKG-INFO +3 -5
- mbtaclient-0.2.4/pyproject.toml +25 -0
- {mbtaclient-0.2.2 → mbtaclient-0.2.4}/src/MBTAclient.egg-info/PKG-INFO +3 -5
- mbtaclient-0.2.4/src/MBTAclient.egg-info/SOURCES.txt +22 -0
- mbtaclient-0.2.4/src/MBTAclient.egg-info/requires.txt +1 -0
- mbtaclient-0.2.4/src/MBTAclient.egg-info/top_level.txt +1 -0
- {mbtaclient-0.2.2/src → mbtaclient-0.2.4/src/mbtaclient}/trip_handler.py +2 -3
- mbtaclient-0.2.2/pyproject.toml +0 -21
- mbtaclient-0.2.2/src/MBTAclient.egg-info/SOURCES.txt +0 -22
- mbtaclient-0.2.2/src/MBTAclient.egg-info/top_level.txt +0 -1
- mbtaclient-0.2.2/src/main.py +0 -171
- {mbtaclient-0.2.2 → mbtaclient-0.2.4}/LICENSE +0 -0
- {mbtaclient-0.2.2 → mbtaclient-0.2.4}/README.md +0 -0
- {mbtaclient-0.2.2 → mbtaclient-0.2.4}/setup.cfg +0 -0
- {mbtaclient-0.2.2 → mbtaclient-0.2.4}/src/MBTAclient.egg-info/dependency_links.txt +0 -0
- {mbtaclient-0.2.2/src → mbtaclient-0.2.4/src/mbtaclient}/__init__.py +0 -0
- {mbtaclient-0.2.2/src → mbtaclient-0.2.4/src/mbtaclient}/base_handler.py +0 -0
- {mbtaclient-0.2.2/src → mbtaclient-0.2.4/src/mbtaclient}/journey.py +0 -0
- {mbtaclient-0.2.2/src → mbtaclient-0.2.4/src/mbtaclient}/journey_stop.py +0 -0
- {mbtaclient-0.2.2/src → mbtaclient-0.2.4/src/mbtaclient}/journeys_handler.py +0 -0
- {mbtaclient-0.2.2/src → mbtaclient-0.2.4/src/mbtaclient}/mbta_alert.py +0 -0
- {mbtaclient-0.2.2/src → mbtaclient-0.2.4/src/mbtaclient}/mbta_client.py +0 -0
- {mbtaclient-0.2.2/src → mbtaclient-0.2.4/src/mbtaclient}/mbta_prediction.py +0 -0
- {mbtaclient-0.2.2/src → mbtaclient-0.2.4/src/mbtaclient}/mbta_route.py +0 -0
- {mbtaclient-0.2.2/src → mbtaclient-0.2.4/src/mbtaclient}/mbta_schedule.py +0 -0
- {mbtaclient-0.2.2/src → mbtaclient-0.2.4/src/mbtaclient}/mbta_stop.py +0 -0
- {mbtaclient-0.2.2/src → mbtaclient-0.2.4/src/mbtaclient}/mbta_trip.py +0 -0
- {mbtaclient-0.2.2/src → mbtaclient-0.2.4/src/mbtaclient}/mbta_utils.py +0 -0
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: MBTAclient
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: A Python client for interacting with the MBTA API
|
|
5
5
|
Author-email: Luca Chiabrera <luca.chiabrera@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/chiabre/MBTAclient
|
|
7
7
|
Project-URL: Issues, https://github.com/chiabre/MBTAclient/issues
|
|
8
|
-
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
-
Classifier: Operating System :: OS Independent
|
|
11
|
-
Requires-Python: >=3.8
|
|
8
|
+
Requires-Python: >=3.12
|
|
12
9
|
Description-Content-Type: text/markdown
|
|
13
10
|
License-File: LICENSE
|
|
11
|
+
Requires-Dist: aiohttp>=3.9.5
|
|
14
12
|
|
|
15
13
|
# MBTAclient
|
|
16
14
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "MBTAclient"
|
|
7
|
+
version = "0.2.4"
|
|
8
|
+
description = "A Python client for interacting with the MBTA API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.12"
|
|
11
|
+
dependencies = [
|
|
12
|
+
"aiohttp>=3.9.5"
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
[[project.authors]]
|
|
16
|
+
name = "Luca Chiabrera"
|
|
17
|
+
email = "luca.chiabrera@gmail.com"
|
|
18
|
+
|
|
19
|
+
[project.urls]
|
|
20
|
+
Homepage = "https://github.com/chiabre/MBTAclient"
|
|
21
|
+
Issues = "https://github.com/chiabre/MBTAclient/issues"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
[tool.setuptools.packages.find]
|
|
25
|
+
where = ["src"]
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: MBTAclient
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: A Python client for interacting with the MBTA API
|
|
5
5
|
Author-email: Luca Chiabrera <luca.chiabrera@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/chiabre/MBTAclient
|
|
7
7
|
Project-URL: Issues, https://github.com/chiabre/MBTAclient/issues
|
|
8
|
-
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
-
Classifier: Operating System :: OS Independent
|
|
11
|
-
Requires-Python: >=3.8
|
|
8
|
+
Requires-Python: >=3.12
|
|
12
9
|
Description-Content-Type: text/markdown
|
|
13
10
|
License-File: LICENSE
|
|
11
|
+
Requires-Dist: aiohttp>=3.9.5
|
|
14
12
|
|
|
15
13
|
# MBTAclient
|
|
16
14
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/MBTAclient.egg-info/PKG-INFO
|
|
5
|
+
src/MBTAclient.egg-info/SOURCES.txt
|
|
6
|
+
src/MBTAclient.egg-info/dependency_links.txt
|
|
7
|
+
src/MBTAclient.egg-info/requires.txt
|
|
8
|
+
src/MBTAclient.egg-info/top_level.txt
|
|
9
|
+
src/mbtaclient/__init__.py
|
|
10
|
+
src/mbtaclient/base_handler.py
|
|
11
|
+
src/mbtaclient/journey.py
|
|
12
|
+
src/mbtaclient/journey_stop.py
|
|
13
|
+
src/mbtaclient/journeys_handler.py
|
|
14
|
+
src/mbtaclient/mbta_alert.py
|
|
15
|
+
src/mbtaclient/mbta_client.py
|
|
16
|
+
src/mbtaclient/mbta_prediction.py
|
|
17
|
+
src/mbtaclient/mbta_route.py
|
|
18
|
+
src/mbtaclient/mbta_schedule.py
|
|
19
|
+
src/mbtaclient/mbta_stop.py
|
|
20
|
+
src/mbtaclient/mbta_trip.py
|
|
21
|
+
src/mbtaclient/mbta_utils.py
|
|
22
|
+
src/mbtaclient/trip_handler.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
aiohttp>=3.9.5
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mbtaclient
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
from typing import Optional
|
|
2
|
-
import traceback
|
|
3
1
|
import aiohttp
|
|
2
|
+
import logging
|
|
4
3
|
|
|
5
4
|
from base_handler import BaseHandler
|
|
6
5
|
from journey import Journey
|
|
@@ -12,7 +11,7 @@ from mbta_prediction import MBTAPrediction
|
|
|
12
11
|
class TripHandler(BaseHandler):
|
|
13
12
|
"""Handler for managing a specific trip."""
|
|
14
13
|
|
|
15
|
-
def __init__(self, session: aiohttp.ClientSession, logger, depart_from_name: str, arrive_at_name: str, trip_name: str, api_key:str = None ) :
|
|
14
|
+
def __init__(self, session: aiohttp.ClientSession, logger: logging.Logger, depart_from_name: str, arrive_at_name: str, trip_name: str, api_key:str = None ) :
|
|
16
15
|
super().__init__(session, logger, depart_from_name, arrive_at_name, api_key)
|
|
17
16
|
self.trip_name = trip_name
|
|
18
17
|
|
mbtaclient-0.2.2/pyproject.toml
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
[project]
|
|
2
|
-
name = "MBTAclient"
|
|
3
|
-
version = "0.2.2"
|
|
4
|
-
authors = [
|
|
5
|
-
{ name="Luca Chiabrera", email="luca.chiabrera@gmail.com" },
|
|
6
|
-
]
|
|
7
|
-
description = "A Python client for interacting with the MBTA API"
|
|
8
|
-
readme = "README.md"
|
|
9
|
-
requires-python = ">=3.8"
|
|
10
|
-
classifiers = [
|
|
11
|
-
"Programming Language :: Python :: 3",
|
|
12
|
-
"License :: OSI Approved :: MIT License",
|
|
13
|
-
"Operating System :: OS Independent",
|
|
14
|
-
]
|
|
15
|
-
|
|
16
|
-
[project.urls]
|
|
17
|
-
Homepage = "https://github.com/chiabre/MBTAclient"
|
|
18
|
-
Issues = "https://github.com/chiabre/MBTAclient/issues"
|
|
19
|
-
|
|
20
|
-
[tool.setuptools.packages.find]
|
|
21
|
-
where = ["src"]
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
LICENSE
|
|
2
|
-
README.md
|
|
3
|
-
pyproject.toml
|
|
4
|
-
src/__init__.py
|
|
5
|
-
src/base_handler.py
|
|
6
|
-
src/journey.py
|
|
7
|
-
src/journey_stop.py
|
|
8
|
-
src/journeys_handler.py
|
|
9
|
-
src/main.py
|
|
10
|
-
src/mbta_alert.py
|
|
11
|
-
src/mbta_client.py
|
|
12
|
-
src/mbta_prediction.py
|
|
13
|
-
src/mbta_route.py
|
|
14
|
-
src/mbta_schedule.py
|
|
15
|
-
src/mbta_stop.py
|
|
16
|
-
src/mbta_trip.py
|
|
17
|
-
src/mbta_utils.py
|
|
18
|
-
src/trip_handler.py
|
|
19
|
-
src/MBTAclient.egg-info/PKG-INFO
|
|
20
|
-
src/MBTAclient.egg-info/SOURCES.txt
|
|
21
|
-
src/MBTAclient.egg-info/dependency_links.txt
|
|
22
|
-
src/MBTAclient.egg-info/top_level.txt
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
mbtaclient-0.2.2/src/main.py
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import aiohttp
|
|
2
|
-
import logging
|
|
3
|
-
from trip_handler import TripHandler
|
|
4
|
-
from journeys_handler import JourneysHandler
|
|
5
|
-
from journey import Journey
|
|
6
|
-
|
|
7
|
-
_LOGGER = logging.getLogger("MBTAClient")
|
|
8
|
-
|
|
9
|
-
logging.basicConfig(level=logging.INFO, # Set the logging level to DEBUG
|
|
10
|
-
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
|
11
|
-
|
|
12
|
-
API_KEY = ''
|
|
13
|
-
MAX_JOURNEYS = 1
|
|
14
|
-
|
|
15
|
-
# DEPART_FROM = 'South Station'
|
|
16
|
-
# ARRIVE_AT = 'Wellesley Square'
|
|
17
|
-
|
|
18
|
-
# DEPART_FROM = 'Wellesley Square'
|
|
19
|
-
# ARRIVE_AT = 'South Station'
|
|
20
|
-
|
|
21
|
-
# DEPART_FROM = 'South Station'
|
|
22
|
-
# ARRIVE_AT = 'Braintree'
|
|
23
|
-
|
|
24
|
-
# DEPART_FROM = 'Copley'
|
|
25
|
-
# ARRIVE_AT = 'Park Street'
|
|
26
|
-
|
|
27
|
-
# DEPART_FROM = 'North Station'
|
|
28
|
-
# ARRIVE_AT = 'Swampscott'
|
|
29
|
-
|
|
30
|
-
# DEPART_FROM = 'Dorchester Ave @ Valley Rd'
|
|
31
|
-
# ARRIVE_AT = 'River St @ Standard St'
|
|
32
|
-
|
|
33
|
-
# DEPART_FROM = 'Back Bay'
|
|
34
|
-
# ARRIVE_AT = 'Huntington Ave @ Opera Pl'
|
|
35
|
-
|
|
36
|
-
# DEPART_FROM = 'Charlestown Navy Yard'
|
|
37
|
-
# ARRIVE_AT = 'Long Wharf (South)'
|
|
38
|
-
|
|
39
|
-
# DEPART_FROM = 'North Billerica'
|
|
40
|
-
# ARRIVE_AT = 'North Station'
|
|
41
|
-
|
|
42
|
-
# DEPART_FROM = 'Back Bay'
|
|
43
|
-
# ARRIVE_AT = 'South Station'
|
|
44
|
-
|
|
45
|
-
# DEPART_FROM = 'Pemberton Point'
|
|
46
|
-
# ARRIVE_AT = 'Summer St from Cushing Way to Water St (FLAG)'
|
|
47
|
-
|
|
48
|
-
TRIP = '518'
|
|
49
|
-
DEPART_FROM = 'Wellesley Square'
|
|
50
|
-
ARRIVE_AT = 'South Station'
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
def print_journey(journey: Journey):
|
|
54
|
-
route_type = journey.get_route_type()
|
|
55
|
-
|
|
56
|
-
# if subway or ferry
|
|
57
|
-
if route_type in [0, 1, 4]:
|
|
58
|
-
|
|
59
|
-
_LOGGER.info("###########")
|
|
60
|
-
_LOGGER.info("Line: %s", journey.get_route_long_name())
|
|
61
|
-
_LOGGER.info("Type: %s", journey.get_route_description())
|
|
62
|
-
_LOGGER.info("Color: %s", journey.get_route_color())
|
|
63
|
-
_LOGGER.info("**********")
|
|
64
|
-
_LOGGER.info("Direction: %s to %s", journey.get_trip_direction(), journey.get_trip_destination())
|
|
65
|
-
_LOGGER.info("Destination: %s", journey.get_trip_headsign())
|
|
66
|
-
_LOGGER.info("Duration: %s", journey.get_trip_duration())
|
|
67
|
-
_LOGGER.info("**********")
|
|
68
|
-
_LOGGER.info("Departure Station: %s", journey.get_stop_name('departure'))
|
|
69
|
-
_LOGGER.info("Departure Platform: %s", journey.get_platform_name('departure'))
|
|
70
|
-
_LOGGER.info("Departure Time: %s", journey.get_stop_time('departure'))
|
|
71
|
-
_LOGGER.info("Departure Delay: %s", journey.get_stop_delay('departure'))
|
|
72
|
-
_LOGGER.info("Departure Time To: %s", journey.get_stop_time_to('departure'))
|
|
73
|
-
_LOGGER.info("%s", journey.get_stop_status('departure'))
|
|
74
|
-
_LOGGER.info("**********")
|
|
75
|
-
_LOGGER.info("Arrival Station: %s", journey.get_stop_name('arrival'))
|
|
76
|
-
_LOGGER.info("Arrival Platform: %s", journey.get_platform_name('arrival'))
|
|
77
|
-
_LOGGER.info("Arrival Time: %s", journey.get_stop_time('arrival'))
|
|
78
|
-
_LOGGER.info("Arrival Delay: %s", journey.get_stop_delay('arrival'))
|
|
79
|
-
_LOGGER.info("Arrival Time To: %s", journey.get_stop_time_to('arrival'))
|
|
80
|
-
_LOGGER.info("%s", journey.get_stop_status('arrival'))
|
|
81
|
-
_LOGGER.info("**********")
|
|
82
|
-
for j in range(len(journey.alerts)):
|
|
83
|
-
_LOGGER.info("Alert: %s", journey.get_alert_header(j))
|
|
84
|
-
|
|
85
|
-
# if train
|
|
86
|
-
elif route_type == 2:
|
|
87
|
-
|
|
88
|
-
_LOGGER.info("###########")
|
|
89
|
-
_LOGGER.info("Line: %s", journey.get_route_long_name())
|
|
90
|
-
_LOGGER.info("Type: %s", journey.get_route_description())
|
|
91
|
-
_LOGGER.info("Color: %s", journey.get_route_color())
|
|
92
|
-
_LOGGER.info("Train Number: %s", journey.get_trip_name())
|
|
93
|
-
_LOGGER.info("**********")
|
|
94
|
-
_LOGGER.info("Direction: %s to %s", journey.get_trip_direction(), journey.get_trip_destination())
|
|
95
|
-
_LOGGER.info("Destination: %s", journey.get_trip_headsign())
|
|
96
|
-
_LOGGER.info("Duration: %s", journey.get_trip_duration())
|
|
97
|
-
_LOGGER.info("**********")
|
|
98
|
-
_LOGGER.info("Departure Station: %s", journey.get_stop_name('departure'))
|
|
99
|
-
_LOGGER.info("Departure Platform: %s", journey.get_platform_name('departure'))
|
|
100
|
-
_LOGGER.info("Departure Time: %s", journey.get_stop_time('departure'))
|
|
101
|
-
_LOGGER.info("Departure Delay: %s", journey.get_stop_delay('departure'))
|
|
102
|
-
_LOGGER.info("Departure Time To: %s", journey.get_stop_time_to('departure'))
|
|
103
|
-
_LOGGER.info("%s", journey.get_stop_status('departure'))
|
|
104
|
-
_LOGGER.info("**********")
|
|
105
|
-
_LOGGER.info("Arrival Station: %s", journey.get_stop_name('arrival'))
|
|
106
|
-
_LOGGER.info("Arrival Platform: %s", journey.get_platform_name('arrival'))
|
|
107
|
-
_LOGGER.info("Arrival Time: %s", journey.get_stop_time('arrival'))
|
|
108
|
-
_LOGGER.info("Arrival Delay: %s", journey.get_stop_delay('arrival'))
|
|
109
|
-
_LOGGER.info("Arrival Time To: %s", journey.get_stop_time_to('arrival'))
|
|
110
|
-
_LOGGER.info("%s", journey.get_stop_status('arrival'))
|
|
111
|
-
_LOGGER.info("**********")
|
|
112
|
-
for j in range(len(journey.alerts)):
|
|
113
|
-
_LOGGER.info("Alert: %s", journey.get_alert_header(j))
|
|
114
|
-
|
|
115
|
-
# if bus
|
|
116
|
-
elif route_type == 3:
|
|
117
|
-
|
|
118
|
-
_LOGGER.info("###########")
|
|
119
|
-
_LOGGER.info("Line: %s", journey.get_route_short_name())
|
|
120
|
-
_LOGGER.info("Type: %s", journey.get_route_description())
|
|
121
|
-
_LOGGER.info("Color: %s", journey.get_route_color())
|
|
122
|
-
_LOGGER.info("**********")
|
|
123
|
-
_LOGGER.info("Direction: %s to %s", journey.get_trip_direction(), journey.get_trip_destination())
|
|
124
|
-
_LOGGER.info("Destination: %s", journey.get_trip_headsign())
|
|
125
|
-
_LOGGER.info("Duration: %s", journey.get_trip_duration())
|
|
126
|
-
_LOGGER.info("**********")
|
|
127
|
-
_LOGGER.info("Departure Stop: %s", journey.get_stop_name('departure'))
|
|
128
|
-
_LOGGER.info("Departure Time: %s", journey.get_stop_time('departure'))
|
|
129
|
-
_LOGGER.info("Departure Delay: %s", journey.get_stop_delay('departure'))
|
|
130
|
-
_LOGGER.info("Departure Time To: %s", journey.get_stop_time_to('departure'))
|
|
131
|
-
_LOGGER.info("%s", journey.get_stop_status('departure'))
|
|
132
|
-
_LOGGER.info("**********")
|
|
133
|
-
_LOGGER.info("Arrival Stop: %s", journey.get_stop_name('arrival'))
|
|
134
|
-
_LOGGER.info("Arrival Time: %s", journey.get_stop_time('arrival'))
|
|
135
|
-
_LOGGER.info("Arrival Delay: %s", journey.get_stop_delay('arrival'))
|
|
136
|
-
_LOGGER.info("Arrival Time To: %s", journey.get_stop_time_to('arrival'))
|
|
137
|
-
_LOGGER.info("%s", journey.get_stop_status('arrival'))
|
|
138
|
-
_LOGGER.info("**********")
|
|
139
|
-
for j in range(len(journey.alerts)):
|
|
140
|
-
_LOGGER.info("Alert: %s", journey.get_alert_header(j))
|
|
141
|
-
|
|
142
|
-
else:
|
|
143
|
-
_LOGGER.error('ARGH!')
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
async def main():
|
|
147
|
-
async with aiohttp.ClientSession() as session:
|
|
148
|
-
|
|
149
|
-
trip_hadler = TripHandler(session, _LOGGER, DEPART_FROM, ARRIVE_AT, TRIP, API_KEY)
|
|
150
|
-
|
|
151
|
-
await trip_hadler.async_init()
|
|
152
|
-
|
|
153
|
-
trips = await trip_hadler.update()
|
|
154
|
-
|
|
155
|
-
for trip in trips:
|
|
156
|
-
print_journey(trip)
|
|
157
|
-
|
|
158
|
-
journeys_handler = JourneysHandler(session, _LOGGER, DEPART_FROM, ARRIVE_AT, MAX_JOURNEYS, API_KEY)
|
|
159
|
-
|
|
160
|
-
await journeys_handler.async_init()
|
|
161
|
-
|
|
162
|
-
journeys = await journeys_handler.update()
|
|
163
|
-
|
|
164
|
-
for journey in journeys:
|
|
165
|
-
print_journey(journey)
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
# Run the main function
|
|
170
|
-
import asyncio
|
|
171
|
-
asyncio.run(main())
|
|
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
|