-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathgeocoding.py
More file actions
34 lines (26 loc) · 850 Bytes
/
geocoding.py
File metadata and controls
34 lines (26 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import typing as t
from ..core.rate_limit import rate_limiter
from ..core.validation import validate_response
class TextGeocoding:
"""Manage geocoding related calls."""
def __init__(self, api):
"""Init."""
self.client = api
@rate_limiter
def post(
self,
texts: t.List[str],
) -> t.Dict[str, t.Any]:
"""
Geocode a list of texts.
Args:
texts: <list[str]>
Geocode a list of texts. Example: ["112 avenue charles de gaulle 92200 neuilly-sur-seine", "New York", "7 rue 4 septembre Paris"].
Returns:
`/text/geocoding` response
"""
payload = dict(
texts=texts,
)
response = self.client.post("text/geocoding", json=payload)
return validate_response(response)