mapillary-downloader 0.1.0__py3-none-any.whl → 0.1.2__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.
- mapillary_downloader/client.py +41 -16
- mapillary_downloader-0.1.2.dist-info/METADATA +92 -0
- mapillary_downloader-0.1.2.dist-info/RECORD +10 -0
- mapillary_downloader-0.1.2.dist-info/entry_points.txt +3 -0
- mapillary_downloader-0.1.0.dist-info/METADATA +0 -54
- mapillary_downloader-0.1.0.dist-info/RECORD +0 -9
- {mapillary_downloader-0.1.0.dist-info → mapillary_downloader-0.1.2.dist-info}/WHEEL +0 -0
- {mapillary_downloader-0.1.0.dist-info → mapillary_downloader-0.1.2.dist-info}/licenses/LICENSE.md +0 -0
mapillary_downloader/client.py
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
import time
|
4
4
|
import requests
|
5
|
+
from requests.exceptions import RequestException
|
5
6
|
|
6
7
|
|
7
8
|
class MapillaryClient:
|
@@ -66,8 +67,22 @@ class MapillaryClient:
|
|
66
67
|
url = f"{self.base_url}/images"
|
67
68
|
|
68
69
|
while url:
|
69
|
-
|
70
|
-
|
70
|
+
max_retries = 10
|
71
|
+
base_delay = 1.0
|
72
|
+
|
73
|
+
for attempt in range(max_retries):
|
74
|
+
try:
|
75
|
+
response = self.session.get(url, params=params)
|
76
|
+
response.raise_for_status()
|
77
|
+
break
|
78
|
+
except RequestException as e:
|
79
|
+
if attempt == max_retries - 1:
|
80
|
+
raise
|
81
|
+
|
82
|
+
delay = base_delay * (2 ** attempt)
|
83
|
+
print(f"Request failed (attempt {attempt + 1}/{max_retries}): {e}")
|
84
|
+
print(f"Retrying in {delay:.1f} seconds...")
|
85
|
+
time.sleep(delay)
|
71
86
|
|
72
87
|
data = response.json()
|
73
88
|
|
@@ -91,17 +106,27 @@ class MapillaryClient:
|
|
91
106
|
Returns:
|
92
107
|
Number of bytes downloaded if successful, 0 otherwise
|
93
108
|
"""
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
109
|
+
max_retries = 10
|
110
|
+
base_delay = 1.0
|
111
|
+
|
112
|
+
for attempt in range(max_retries):
|
113
|
+
try:
|
114
|
+
response = self.session.get(image_url, stream=True)
|
115
|
+
response.raise_for_status()
|
116
|
+
|
117
|
+
total_bytes = 0
|
118
|
+
with open(output_path, "wb") as f:
|
119
|
+
for chunk in response.iter_content(chunk_size=8192):
|
120
|
+
f.write(chunk)
|
121
|
+
total_bytes += len(chunk)
|
122
|
+
|
123
|
+
return total_bytes
|
124
|
+
except RequestException as e:
|
125
|
+
if attempt == max_retries - 1:
|
126
|
+
print(f"Error downloading {image_url} after {max_retries} attempts: {e}")
|
127
|
+
return 0
|
128
|
+
|
129
|
+
delay = base_delay * (2 ** attempt)
|
130
|
+
print(f"Download failed (attempt {attempt + 1}/{max_retries}): {e}")
|
131
|
+
print(f"Retrying in {delay:.1f} seconds...")
|
132
|
+
time.sleep(delay)
|
@@ -0,0 +1,92 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: mapillary_downloader
|
3
|
+
Version: 0.1.2
|
4
|
+
Summary: Download your Mapillary data before it's gone
|
5
|
+
Author-email: Gareth Davidson <gaz@bitplane.net>
|
6
|
+
Requires-Python: >=3.10
|
7
|
+
Description-Content-Type: text/markdown
|
8
|
+
Classifier: License :: Public Domain
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
13
|
+
License-File: LICENSE.md
|
14
|
+
Requires-Dist: requests>=2.31.0
|
15
|
+
Requires-Dist: piexif>=1.1.3
|
16
|
+
Requires-Dist: pre-commit ; extra == "dev"
|
17
|
+
Requires-Dist: pytest ; extra == "dev"
|
18
|
+
Requires-Dist: coverage ; extra == "dev"
|
19
|
+
Requires-Dist: pytest-cov ; extra == "dev"
|
20
|
+
Requires-Dist: build ; extra == "dev"
|
21
|
+
Requires-Dist: twine ; extra == "dev"
|
22
|
+
Requires-Dist: ruff ; extra == "dev"
|
23
|
+
Requires-Dist: pydoc-markdown ; extra == "dev"
|
24
|
+
Requires-Dist: Pillow ; extra == "dev"
|
25
|
+
Project-URL: Documentation, https://bitplane.net/dev/python/mapillary_downloader/pydoc
|
26
|
+
Project-URL: Homepage, https://bitplane.net/dev/python/mapillary_downloader
|
27
|
+
Project-URL: Issues, https://github.com/bitplane/mapillary_downloader/issues
|
28
|
+
Project-URL: Repository, https://github.com/bitplane/mapillary_downloader
|
29
|
+
Provides-Extra: dev
|
30
|
+
|
31
|
+
# Mapillary Downloader
|
32
|
+
|
33
|
+
Download your Mapillary data before it's gone.
|
34
|
+
|
35
|
+
## Installation
|
36
|
+
|
37
|
+
```bash
|
38
|
+
pip install mapillary-downloader
|
39
|
+
```
|
40
|
+
|
41
|
+
Or from source:
|
42
|
+
|
43
|
+
```bash
|
44
|
+
make install
|
45
|
+
```
|
46
|
+
|
47
|
+
## Usage
|
48
|
+
|
49
|
+
First, get your Mapillary API access token from https://www.mapillary.com/dashboard/developers
|
50
|
+
|
51
|
+
```bash
|
52
|
+
mapillary-downloader --token YOUR_TOKEN --username YOUR_USERNAME --output ./downloads
|
53
|
+
```
|
54
|
+
|
55
|
+
| option | because | default |
|
56
|
+
| ------------- | ------------------------------------- | ------------------ |
|
57
|
+
| `--token` | Your Mapillary API access token | None (required) |
|
58
|
+
| `--username` | Your Mapillary username | None (required) |
|
59
|
+
| `--output` | Output directory | `./mapillary_data` |
|
60
|
+
| `--quality` | 256, 1024, 2048 or original | `original` |
|
61
|
+
| `--bbox` | `west,south,east,north` | `None` |
|
62
|
+
|
63
|
+
The downloader will:
|
64
|
+
|
65
|
+
* 💾 Fetch all your uploaded images from Mapillary
|
66
|
+
- 📷 Download full-resolution images organized by sequence
|
67
|
+
- 📜 Inject EXIF metadata (GPS coordinates, camera info, timestamps, compass direction)
|
68
|
+
- 🛟 Save progress so you can safely resume if interrupted
|
69
|
+
|
70
|
+
## Development
|
71
|
+
|
72
|
+
```bash
|
73
|
+
make dev # Setup dev environment
|
74
|
+
make test # Run tests
|
75
|
+
make coverage # Run tests with coverage
|
76
|
+
```
|
77
|
+
|
78
|
+
## Links
|
79
|
+
|
80
|
+
* [🏠 home](https://bitplane.net/dev/python/mapillary_downloader)
|
81
|
+
* [📖 pydoc](https://bitplane.net/dev/python/mapillary_downloader/pydoc)
|
82
|
+
* [🐍 pypi](https://pypi.org/project/mapillary-downloader)
|
83
|
+
* [🐱 github](https://github.com/bitplane/mapillary_downloader)
|
84
|
+
|
85
|
+
## License
|
86
|
+
|
87
|
+
WTFPL with one additional clause
|
88
|
+
|
89
|
+
1. Don't blame me
|
90
|
+
|
91
|
+
Do wtf you want, but don't blame me when it breaks.
|
92
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
mapillary_downloader/__init__.py,sha256=KEjiBRghXDeA7E15RJeLBfQm-yNJkowZarL59QOh_1w,120
|
2
|
+
mapillary_downloader/__main__.py,sha256=xKYhamK0HYXqx98fGb5CVOEw0syURWgX7jnFIdsK5Ao,1720
|
3
|
+
mapillary_downloader/client.py,sha256=w936htOireWnKgfXJDYls-umYxOzr0FQ4yzklQ6fPM0,4315
|
4
|
+
mapillary_downloader/downloader.py,sha256=n5Y7aAoin3vBa_H3et9hpTNoPrEarbU_LdnHT619c5Y,4216
|
5
|
+
mapillary_downloader/exif_writer.py,sha256=Bn1u3QULfHtae86FnUGcqN450NccJwtwW9wVaSRyx9E,4615
|
6
|
+
mapillary_downloader-0.1.2.dist-info/entry_points.txt,sha256=PdYtxOXHMJrUhmiPO4G-F98VuhUI4MN9D_T4KPrVZ5w,75
|
7
|
+
mapillary_downloader-0.1.2.dist-info/licenses/LICENSE.md,sha256=7_BIuQ-veOrsF-WarH8kTkm0-xrCLvJ1PFE1C4Ebs64,146
|
8
|
+
mapillary_downloader-0.1.2.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
9
|
+
mapillary_downloader-0.1.2.dist-info/METADATA,sha256=07TO0LnPoOTq7gI6G1ZmCe2gbuA3Gzy0yV5rXAEeXlI,3013
|
10
|
+
mapillary_downloader-0.1.2.dist-info/RECORD,,
|
@@ -1,54 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: mapillary_downloader
|
3
|
-
Version: 0.1.0
|
4
|
-
Summary: Download your Mapillary data before it's gone
|
5
|
-
Author-email: Gareth Davidson <gaz@bitplane.net>
|
6
|
-
Requires-Python: >=3.10
|
7
|
-
Description-Content-Type: text/markdown
|
8
|
-
License-File: LICENSE.md
|
9
|
-
Requires-Dist: requests>=2.31.0
|
10
|
-
Requires-Dist: piexif>=1.1.3
|
11
|
-
Requires-Dist: pre-commit ; extra == "dev"
|
12
|
-
Requires-Dist: pytest ; extra == "dev"
|
13
|
-
Requires-Dist: coverage ; extra == "dev"
|
14
|
-
Requires-Dist: pytest-cov ; extra == "dev"
|
15
|
-
Requires-Dist: build ; extra == "dev"
|
16
|
-
Requires-Dist: twine ; extra == "dev"
|
17
|
-
Requires-Dist: ruff ; extra == "dev"
|
18
|
-
Requires-Dist: mkdocs ; extra == "dev"
|
19
|
-
Requires-Dist: mkdocs-material ; extra == "dev"
|
20
|
-
Requires-Dist: pydoc-markdown ; extra == "dev"
|
21
|
-
Requires-Dist: Pillow ; extra == "dev"
|
22
|
-
Provides-Extra: dev
|
23
|
-
|
24
|
-
# Mapillary Downloader
|
25
|
-
|
26
|
-
Download your Mapillary data before it's gone.
|
27
|
-
|
28
|
-
## Installation
|
29
|
-
|
30
|
-
```bash
|
31
|
-
make install
|
32
|
-
```
|
33
|
-
|
34
|
-
## Usage
|
35
|
-
|
36
|
-
First, get your Mapillary API access token from https://www.mapillary.com/dashboard/developers
|
37
|
-
|
38
|
-
```bash
|
39
|
-
source .venv/bin/activate
|
40
|
-
python -m mapillary_downloader --token YOUR_TOKEN --username YOUR_USERNAME --output ./downloads
|
41
|
-
```
|
42
|
-
|
43
|
-
## Development
|
44
|
-
|
45
|
-
```bash
|
46
|
-
make dev # Setup dev environment
|
47
|
-
make test # Run tests
|
48
|
-
make coverage # Run tests with coverage
|
49
|
-
```
|
50
|
-
|
51
|
-
## License
|
52
|
-
|
53
|
-
WTFPL + Warranty (Don't blame me)
|
54
|
-
|
@@ -1,9 +0,0 @@
|
|
1
|
-
mapillary_downloader/__init__.py,sha256=KEjiBRghXDeA7E15RJeLBfQm-yNJkowZarL59QOh_1w,120
|
2
|
-
mapillary_downloader/__main__.py,sha256=xKYhamK0HYXqx98fGb5CVOEw0syURWgX7jnFIdsK5Ao,1720
|
3
|
-
mapillary_downloader/client.py,sha256=VTISi0VororaDei_heNhQpt2H5TDjMnNu7a2ynotUok,3256
|
4
|
-
mapillary_downloader/downloader.py,sha256=n5Y7aAoin3vBa_H3et9hpTNoPrEarbU_LdnHT619c5Y,4216
|
5
|
-
mapillary_downloader/exif_writer.py,sha256=Bn1u3QULfHtae86FnUGcqN450NccJwtwW9wVaSRyx9E,4615
|
6
|
-
mapillary_downloader-0.1.0.dist-info/licenses/LICENSE.md,sha256=7_BIuQ-veOrsF-WarH8kTkm0-xrCLvJ1PFE1C4Ebs64,146
|
7
|
-
mapillary_downloader-0.1.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
8
|
-
mapillary_downloader-0.1.0.dist-info/METADATA,sha256=04P8PB_Gg2xa3SVr-dNuCTH_UJR7oLbovzKgsbgm9Fw,1327
|
9
|
-
mapillary_downloader-0.1.0.dist-info/RECORD,,
|
File without changes
|
{mapillary_downloader-0.1.0.dist-info → mapillary_downloader-0.1.2.dist-info}/licenses/LICENSE.md
RENAMED
File without changes
|