MCPcopy Index your code
hub / github.com/googleapis/google-api-python-client / __init__

Method __init__

googleapiclient/http.py:575–603  ·  view source on GitHub ↗

Constructor. Args: filename: string, Name of the file. mimetype: string, Mime-type of the file. If None then a mime-type will be guessed from the file extension. chunksize: int, File will be uploaded in chunks of this many bytes. Only us

(
        self, filename, mimetype=None, chunksize=DEFAULT_CHUNK_SIZE, resumable=False
    )

Source from the content-addressed store, hash-verified

573
574 @util.positional(2)
575 def __init__(
576 self, filename, mimetype=None, chunksize=DEFAULT_CHUNK_SIZE, resumable=False
577 ):
578 """Constructor.
579
580 Args:
581 filename: string, Name of the file.
582 mimetype: string, Mime-type of the file. If None then a mime-type will be
583 guessed from the file extension.
584 chunksize: int, File will be uploaded in chunks of this many bytes. Only
585 used if resumable=True. Pass in a value of -1 if the file is to be
586 uploaded in a single chunk. Note that Google App Engine has a 5MB limit
587 on request size, so you should never set your chunksize larger than 5MB,
588 or to -1.
589 resumable: bool, True if this is a resumable upload. False means upload
590 in a single request.
591 """
592 self._fd = None
593 self._filename = filename
594 self._fd = open(self._filename, "rb")
595 if mimetype is None:
596 # No mimetype provided, make a guess.
597 mimetype, _ = mimetypes.guess_type(filename)
598 if mimetype is None:
599 # Guess failed, use octet-stream.
600 mimetype = "application/octet-stream"
601 super(MediaFileUpload, self).__init__(
602 self._fd, mimetype, chunksize=chunksize, resumable=resumable
603 )
604
605 def __del__(self):
606 if self._fd:

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected