pycitizen 0.1.0__py3-none-any.whl
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.
- pycitizen/__init__.py +130 -0
- pycitizen/client.py +794 -0
- pycitizen/const.py +81 -0
- pycitizen/exceptions.py +53 -0
- pycitizen/feed.py +222 -0
- pycitizen/models.py +948 -0
- pycitizen/py.typed +0 -0
- pycitizen/ratelimit.py +103 -0
- pycitizen/tiles.py +366 -0
- pycitizen-0.1.0.dist-info/METADATA +193 -0
- pycitizen-0.1.0.dist-info/RECORD +13 -0
- pycitizen-0.1.0.dist-info/WHEEL +4 -0
- pycitizen-0.1.0.dist-info/licenses/LICENSE +21 -0
pycitizen/__init__.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"""pycitizen - async Python SDK for Citizen's public incident API.
|
|
2
|
+
|
|
3
|
+
Reverse-engineered from Citizen Android 0.1308.0 (sp0n.citizen). Only
|
|
4
|
+
endpoints verified reachable without authentication are implemented.
|
|
5
|
+
|
|
6
|
+
Quick start::
|
|
7
|
+
|
|
8
|
+
import asyncio
|
|
9
|
+
from pycitizen import CitizenClient, IncidentFeed
|
|
10
|
+
|
|
11
|
+
NYC = (-74.02, 40.70, -73.93, 40.80) # west, south, east, north
|
|
12
|
+
|
|
13
|
+
async def main() -> None:
|
|
14
|
+
async with CitizenClient() as client:
|
|
15
|
+
markers = await client.get_incident_markers(NYC)
|
|
16
|
+
for m in markers:
|
|
17
|
+
print(m.incident_id, m.title, m.severity.value)
|
|
18
|
+
|
|
19
|
+
asyncio.run(main())
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
from .client import BBox, CitizenClient
|
|
25
|
+
from .const import API_BASE_URL, DEFAULT_TILE_ZOOM, WEBSOCKET_URL
|
|
26
|
+
from .exceptions import (
|
|
27
|
+
CitizenAuthError,
|
|
28
|
+
CitizenConnectionError,
|
|
29
|
+
CitizenError,
|
|
30
|
+
CitizenNotFoundError,
|
|
31
|
+
CitizenParseError,
|
|
32
|
+
CitizenRateLimitError,
|
|
33
|
+
CitizenResponseError,
|
|
34
|
+
CitizenTileError,
|
|
35
|
+
CitizenTimeoutError,
|
|
36
|
+
)
|
|
37
|
+
from .feed import FeedState, FeedUpdate, IncidentFeed, TrackedIncident
|
|
38
|
+
from .models import (
|
|
39
|
+
ChatHistory,
|
|
40
|
+
ChatMessage,
|
|
41
|
+
HistoricalIncident,
|
|
42
|
+
ImpactStatistics,
|
|
43
|
+
Incident,
|
|
44
|
+
IncidentContent,
|
|
45
|
+
IncidentMarker,
|
|
46
|
+
IncidentStats,
|
|
47
|
+
IncidentUpdate,
|
|
48
|
+
LifecycleState,
|
|
49
|
+
NamedLocation,
|
|
50
|
+
NeighborhoodBoundary,
|
|
51
|
+
NeighborhoodDetails,
|
|
52
|
+
NeighborhoodFeed,
|
|
53
|
+
NewsBriefing,
|
|
54
|
+
NewsItem,
|
|
55
|
+
OffenderMarker,
|
|
56
|
+
PlaceMarker,
|
|
57
|
+
Position,
|
|
58
|
+
PublicUser,
|
|
59
|
+
SafetyStatus,
|
|
60
|
+
Severity,
|
|
61
|
+
SocialPresence,
|
|
62
|
+
UsernameCheck,
|
|
63
|
+
)
|
|
64
|
+
from .ratelimit import RateLimiter, RetryPolicy
|
|
65
|
+
from .tiles import (
|
|
66
|
+
VectorTile,
|
|
67
|
+
VectorTileFeature,
|
|
68
|
+
VectorTileLayer,
|
|
69
|
+
decode_tile,
|
|
70
|
+
lonlat_to_tile,
|
|
71
|
+
tile_bounds,
|
|
72
|
+
tiles_for_bbox,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
__version__ = "0.1.0"
|
|
76
|
+
|
|
77
|
+
__all__ = [
|
|
78
|
+
"API_BASE_URL",
|
|
79
|
+
"DEFAULT_TILE_ZOOM",
|
|
80
|
+
"WEBSOCKET_URL",
|
|
81
|
+
"BBox",
|
|
82
|
+
"ChatHistory",
|
|
83
|
+
"ChatMessage",
|
|
84
|
+
"CitizenAuthError",
|
|
85
|
+
"CitizenClient",
|
|
86
|
+
"CitizenConnectionError",
|
|
87
|
+
"CitizenError",
|
|
88
|
+
"CitizenNotFoundError",
|
|
89
|
+
"CitizenParseError",
|
|
90
|
+
"CitizenRateLimitError",
|
|
91
|
+
"CitizenResponseError",
|
|
92
|
+
"CitizenTileError",
|
|
93
|
+
"CitizenTimeoutError",
|
|
94
|
+
"FeedState",
|
|
95
|
+
"FeedUpdate",
|
|
96
|
+
"HistoricalIncident",
|
|
97
|
+
"ImpactStatistics",
|
|
98
|
+
"Incident",
|
|
99
|
+
"IncidentContent",
|
|
100
|
+
"IncidentFeed",
|
|
101
|
+
"IncidentMarker",
|
|
102
|
+
"IncidentStats",
|
|
103
|
+
"IncidentUpdate",
|
|
104
|
+
"LifecycleState",
|
|
105
|
+
"NamedLocation",
|
|
106
|
+
"NeighborhoodBoundary",
|
|
107
|
+
"NeighborhoodDetails",
|
|
108
|
+
"NeighborhoodFeed",
|
|
109
|
+
"NewsBriefing",
|
|
110
|
+
"NewsItem",
|
|
111
|
+
"OffenderMarker",
|
|
112
|
+
"PlaceMarker",
|
|
113
|
+
"Position",
|
|
114
|
+
"PublicUser",
|
|
115
|
+
"RateLimiter",
|
|
116
|
+
"RetryPolicy",
|
|
117
|
+
"SafetyStatus",
|
|
118
|
+
"Severity",
|
|
119
|
+
"SocialPresence",
|
|
120
|
+
"TrackedIncident",
|
|
121
|
+
"UsernameCheck",
|
|
122
|
+
"VectorTile",
|
|
123
|
+
"VectorTileFeature",
|
|
124
|
+
"VectorTileLayer",
|
|
125
|
+
"__version__",
|
|
126
|
+
"decode_tile",
|
|
127
|
+
"lonlat_to_tile",
|
|
128
|
+
"tile_bounds",
|
|
129
|
+
"tiles_for_bbox",
|
|
130
|
+
]
|