Skip to content

Commit 1a9d566

Browse files
Abel Milashclaude
andcommitted
Fix async file_upload example: fix remaining .content references for replace downloads
Two download paths after replace uploads still used resp_r.content and resp_rc.content instead of ._body, causing AttributeError. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5fba6de commit 1a9d566

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

examples/aio/advanced/file_upload.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ async def main():
233233
async with client._scoped_odata() as od:
234234
dl_url = f"{od.api}/{entity_set}({record_id})/{small_file_attr_schema.lower()}/$value"
235235
resp_r = await od._request("get", dl_url)
236-
content_r = await resp_r.read() if hasattr(resp_r, "read") else (resp_r.content or b"")
236+
content_r = resp_r._body if hasattr(resp_r, "_body") else b""
237237

238238
dl_hash_r = hashlib.sha256(content_r).hexdigest() if content_r else None
239239
hash_match_r = (dl_hash_r == replace_hash) if (dl_hash_r and replace_hash) else None
@@ -305,7 +305,7 @@ async def main():
305305
async with client._scoped_odata() as od:
306306
dl_url = f"{od.api}/{entity_set}({record_id})/{chunk_file_attr_schema.lower()}/$value"
307307
resp_rc = await od._request("get", dl_url)
308-
content_rc = await resp_rc.read() if hasattr(resp_rc, "read") else (resp_rc.content or b"")
308+
content_rc = resp_rc._body if hasattr(resp_rc, "_body") else b""
309309

310310
dl_hash_rc = hashlib.sha256(content_rc).hexdigest() if content_rc else None
311311
hash_match_rc = (dl_hash_rc == replace_hash_c) if (dl_hash_rc and replace_hash_c) else None

0 commit comments

Comments
 (0)