MCPcopy
hub / github.com/jjjake/internetarchive / upload

Function upload

internetarchive/api.py:233–313  ·  view source on GitHub ↗

r"""Upload files to an item. The item will be created if it does not exist. :param identifier: The globally unique Archive.org identifier for a given item. :param files: The filepaths or file-like objects to upload. This value can be an iterable or a single file-like obje

(
    identifier: str,
    files,
    metadata: Mapping | None = None,
    headers: dict | None = None,
    access_key: str | None = None,
    secret_key: str | None = None,
    queue_derive=None,
    verbose: bool = False,
    verify: bool = False,
    checksum: bool = False,
    delete: bool = False,
    retries: int | None = None,
    retries_sleep: int | None = None,
    debug: bool = False,
    validate_identifier: bool = False,
    request_kwargs: dict | None = None,
    **get_item_kwargs,
)

Source from the content-addressed store, hash-verified

231
232
233def upload(
234 identifier: str,
235 files,
236 metadata: Mapping | None = None,
237 headers: dict | None = None,
238 access_key: str | None = None,
239 secret_key: str | None = None,
240 queue_derive=None,
241 verbose: bool = False,
242 verify: bool = False,
243 checksum: bool = False,
244 delete: bool = False,
245 retries: int | None = None,
246 retries_sleep: int | None = None,
247 debug: bool = False,
248 validate_identifier: bool = False,
249 request_kwargs: dict | None = None,
250 **get_item_kwargs,
251) -> list[requests.Request | requests.Response]:
252 r"""Upload files to an item. The item will be created if it does not exist.
253
254 :param identifier: The globally unique Archive.org identifier for a given item.
255
256 :param files: The filepaths or file-like objects to upload. This value can be an
257 iterable or a single file-like object or string.
258
259 :param metadata: Metadata used to create a new item. If the item already
260 exists, the metadata will not be updated -- use ``modify_metadata``.
261
262 :param headers: Add additional HTTP headers to the request.
263
264 :param access_key: IA-S3 access_key to use when making the given request.
265
266 :param secret_key: IA-S3 secret_key to use when making the given request.
267
268 :param queue_derive: Set to False to prevent an item from being derived
269 after upload.
270
271 :param verbose: Display upload progress.
272
273 :param verify: Verify local MD5 checksum matches the MD5 checksum of the
274 file received by IAS3.
275
276 :param checksum: Skip uploading files based on checksum.
277
278 :param delete: Delete local file after the upload has been successfully
279 verified.
280
281 :param retries: Number of times to retry the given request if S3 returns a
282 503 SlowDown error.
283
284 :param retries_sleep: Amount of time to sleep between ``retries``.
285
286 :param debug: Set to True to print headers to stdout, and exit without
287 sending the upload request.
288
289 :param validate_identifier: Set to True to validate the identifier before
290 uploading the file.

Callers 2

test_uploadFunction · 0.90

Calls 2

get_itemFunction · 0.85
uploadMethod · 0.80

Tested by 2

test_uploadFunction · 0.72