()
| 23 | |
| 24 | |
| 25 | def from_in_memory() -> None: |
| 26 | print("uploading file from memory") |
| 27 | |
| 28 | # read the data into memory ourselves to simulate |
| 29 | # it coming from somewhere else |
| 30 | data = file.read_bytes() |
| 31 | filename = "my_file.txt" |
| 32 | |
| 33 | upload = client.uploads.upload_file_chunked( |
| 34 | file=data, |
| 35 | filename=filename, |
| 36 | bytes=len(data), |
| 37 | mime_type="txt", |
| 38 | purpose="batch", |
| 39 | ) |
| 40 | rich.print(upload) |
| 41 | |
| 42 | |
| 43 | if "memory" in sys.argv: |
no test coverage detected