google-genai 1.8.0__py3-none-any.whl → 1.10.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
google/genai/files.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2024 Google LLC
1
+ # Copyright 2025 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -658,6 +658,14 @@ class Files(_api_module.BaseModule):
658
658
  http_options: types.HttpOptions
659
659
  if config_model and config_model.http_options:
660
660
  http_options = config_model.http_options
661
+ http_options.api_version = ''
662
+ http_options.headers = {
663
+ 'Content-Type': 'application/json',
664
+ 'X-Goog-Upload-Protocol': 'resumable',
665
+ 'X-Goog-Upload-Command': 'start',
666
+ 'X-Goog-Upload-Header-Content-Length': f'{file_obj.size_bytes}',
667
+ 'X-Goog-Upload-Header-Content-Type': f'{file_obj.mime_type}',
668
+ }
661
669
  else:
662
670
  http_options = types.HttpOptions(
663
671
  api_version='',
@@ -685,11 +693,11 @@ class Files(_api_module.BaseModule):
685
693
 
686
694
  if isinstance(file, io.IOBase):
687
695
  return_file = self._api_client.upload_file(
688
- file, upload_url, file_obj.size_bytes
696
+ file, upload_url, file_obj.size_bytes, http_options=http_options
689
697
  )
690
698
  else:
691
699
  return_file = self._api_client.upload_file(
692
- fs_path, upload_url, file_obj.size_bytes
700
+ fs_path, upload_url, file_obj.size_bytes, http_options=http_options
693
701
  )
694
702
 
695
703
  return types.File._from_response(
@@ -778,7 +786,7 @@ class Files(_api_module.BaseModule):
778
786
 
779
787
  data = self._api_client.download_file(
780
788
  path,
781
- http_options,
789
+ http_options=http_options,
782
790
  )
783
791
 
784
792
  if isinstance(file, types.Video):
@@ -1122,6 +1130,14 @@ class AsyncFiles(_api_module.BaseModule):
1122
1130
  http_options: types.HttpOptions
1123
1131
  if config_model and config_model.http_options:
1124
1132
  http_options = config_model.http_options
1133
+ http_options.api_version = ''
1134
+ http_options.headers = {
1135
+ 'Content-Type': 'application/json',
1136
+ 'X-Goog-Upload-Protocol': 'resumable',
1137
+ 'X-Goog-Upload-Command': 'start',
1138
+ 'X-Goog-Upload-Header-Content-Length': f'{file_obj.size_bytes}',
1139
+ 'X-Goog-Upload-Header-Content-Type': f'{file_obj.mime_type}',
1140
+ }
1125
1141
  else:
1126
1142
  http_options = types.HttpOptions(
1127
1143
  api_version='',
@@ -1148,11 +1164,11 @@ class AsyncFiles(_api_module.BaseModule):
1148
1164
 
1149
1165
  if isinstance(file, io.IOBase):
1150
1166
  return_file = await self._api_client.async_upload_file(
1151
- file, upload_url, file_obj.size_bytes
1167
+ file, upload_url, file_obj.size_bytes, http_options=http_options
1152
1168
  )
1153
1169
  else:
1154
1170
  return_file = await self._api_client.async_upload_file(
1155
- fs_path, upload_url, file_obj.size_bytes
1171
+ fs_path, upload_url, file_obj.size_bytes, http_options=http_options
1156
1172
  )
1157
1173
 
1158
1174
  return types.File._from_response(
@@ -1231,7 +1247,7 @@ class AsyncFiles(_api_module.BaseModule):
1231
1247
 
1232
1248
  data = await self._api_client.async_download_file(
1233
1249
  path,
1234
- http_options,
1250
+ http_options=http_options,
1235
1251
  )
1236
1252
 
1237
1253
  return data