(req_args: dict)
| 140 | |
| 141 | |
| 142 | def _files_to_data(req_args: dict) -> List[BinaryIO]: |
| 143 | open_files = [] |
| 144 | files = req_args.pop("files", None) |
| 145 | if files is not None: |
| 146 | for k, v in files.items(): |
| 147 | if isinstance(v, str): |
| 148 | f = open(v.encode("utf-8", "ignore"), "rb") |
| 149 | open_files.append(f) |
| 150 | req_args["data"].update({k: f}) |
| 151 | else: |
| 152 | req_args["data"].update({k: v}) |
| 153 | return open_files |
| 154 | |
| 155 | |
| 156 | async def _request_with_session( |