Skip to content

Commit 32a77d8

Browse files
authored
Merge pull request #93 from MrClock8163/feature/update-download-return-type
Update download methods to return bytes
2 parents 122bb6e + 33fef42 commit 32a77d8

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ The project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
2121
- Renamed `parsebool` to `parse_bool`
2222
- Renamed `toenum` to `get_enum`
2323
- Renamed `enumparser` to `get_enum_parser`
24+
- Updated GeoCOM FTR `download` to return `bytes` instead of `str`
25+
- Updated GeoCOM FTR `download_large` to return `bytes` instead of `str`
2426

2527
### Fixed
2628

src/geocompy/geo/ftr.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def setup_download(
238238
def download(
239239
self,
240240
block: int
241-
) -> GeoComResponse[str]:
241+
) -> GeoComResponse[bytes]:
242242
"""
243243
RPC 23304, ``FTR_Download``
244244
@@ -248,13 +248,13 @@ def download(
248248
Parameters
249249
----------
250250
block : int
251-
Number of data block to download.
251+
Index of data block to download.
252252
253253
Returns
254254
-------
255255
GeoComResponse
256256
Params:
257-
- `str`: Data block as hexadecimal byte string.
257+
- `bytes`: Data block.
258258
259259
Error codes:
260260
- ``FTR_MISSINGSETUP``: No active download setup.
@@ -270,7 +270,7 @@ def download(
270270
return self._request(
271271
23304,
272272
[block],
273-
parse_string
273+
lambda data: bytes.fromhex(parse_string(data))
274274
)
275275

276276
def abort_download(self) -> GeoComResponse[None]:
@@ -468,7 +468,7 @@ def setup_large_download(
468468
def download_large(
469469
self,
470470
block: int
471-
) -> GeoComResponse[str]:
471+
) -> GeoComResponse[bytes]:
472472
"""
473473
RPC 23314, ``FTR_DownloadXL``
474474
@@ -480,13 +480,13 @@ def download_large(
480480
Parameters
481481
----------
482482
block : int
483-
Number of data block to download.
483+
Index of data block to download.
484484
485485
Returns
486486
-------
487487
GeoComResponse
488488
Params:
489-
- `str`: Data block as hexadecimal byte string.
489+
- `bytes`: Data block.
490490
491491
Error codes:
492492
- ``FTR_MISSINGSETUP``: No active download setup.
@@ -502,5 +502,5 @@ def download_large(
502502
return self._request(
503503
23314,
504504
[block],
505-
parse_string
505+
lambda data: bytes.fromhex(parse_string(data))
506506
)

0 commit comments

Comments
 (0)