@@ -477,8 +477,13 @@ <h1 class="title">Module <code>scrapfly.api_response</code></h1>
477
477
478
478
if content_format in ['clob', 'blob']:
479
479
api_result['result']['content'], api_result['result']['format'] = self.large_object_handler(callback_url=api_result['result']['content'], format=content_format)
480
- elif content_format == 'binary' and isinstance(api_result['result']['content'], bytes):
481
- api_result['result']['content'] = BytesIO(b64decode(api_result['result']['content']))
480
+ elif content_format == 'binary':
481
+ base64_payload = api_result['result']['content']
482
+
483
+ if isinstance(base64_payload, bytes):
484
+ base64_payload = base64_payload.decode('utf-8')
485
+
486
+ api_result['result']['content'] = BytesIO(b64decode(base64_payload))
482
487
483
488
return FrozenDict(api_result)
484
489
@@ -1690,8 +1695,13 @@ <h3>Methods</h3>
1690
1695
1691
1696
if content_format in ['clob', 'blob']:
1692
1697
api_result['result']['content'], api_result['result']['format'] = self.large_object_handler(callback_url=api_result['result']['content'], format=content_format)
1693
- elif content_format == 'binary' and isinstance(api_result['result']['content'], bytes):
1694
- api_result['result']['content'] = BytesIO(b64decode(api_result['result']['content']))
1698
+ elif content_format == 'binary':
1699
+ base64_payload = api_result['result']['content']
1700
+
1701
+ if isinstance(base64_payload, bytes):
1702
+ base64_payload = base64_payload.decode('utf-8')
1703
+
1704
+ api_result['result']['content'] = BytesIO(b64decode(base64_payload))
1695
1705
1696
1706
return FrozenDict(api_result)
1697
1707
@@ -2099,8 +2109,13 @@ <h3>Methods</h3>
2099
2109
2100
2110
if content_format in ['clob', 'blob']:
2101
2111
api_result['result']['content'], api_result['result']['format'] = self.large_object_handler(callback_url=api_result['result']['content'], format=content_format)
2102
- elif content_format == 'binary' and isinstance(api_result['result']['content'], bytes):
2103
- api_result['result']['content'] = BytesIO(b64decode(api_result['result']['content']))
2112
+ elif content_format == 'binary':
2113
+ base64_payload = api_result['result']['content']
2114
+
2115
+ if isinstance(base64_payload, bytes):
2116
+ base64_payload = base64_payload.decode('utf-8')
2117
+
2118
+ api_result['result']['content'] = BytesIO(b64decode(base64_payload))
2104
2119
2105
2120
return FrozenDict(api_result)</ code > </ pre >
2106
2121
</ details >
0 commit comments