def upload_tus(cls, path, name=None, parent_id=0): headers = {'Authorization': 'token %s' % cls.client.access_token} metadata = {'parent_id': str(parent_id)} if name: metadata['name'] = name with open(path) as f: tus.upload(f, TUS_UPLOAD_URL, file_name=name, headers=headers, metadata=metadata)
def upload_tus(cls, path, name=None, parent_id=0): headers = {"Authorization": "token %s" % cls.client.access_token} metadata = {"parent_id": str(parent_id)} if name: metadata["name"] = name with open(path) as f: tus.upload(f, TUS_UPLOAD_URL, file_name=name, headers=headers, metadata=metadata)
def upload(self, filename): """ Upload videos to Vectorly :param filename: File name :return: """ url = 'https://tus.vectorly.io/files/' with open(filename, 'rb') as f: tus.upload(f, url, chunk_size=self.chunk_size, metadata={'api_key': self.api_key}) pass
import tus FILE_PATH = 'tes5.mp4' TUS_ENDPOINT = 'https://upload299.fvs.io/upload/' HEADERS = { 'Upload-Metadata': 'token blhUUUNYais4L1UrVllyZVluYnRhNktFYmF5Mnd0V1NyZVd4T2JKbk5mZGNTTHdPUi9HOXAyMzZjT1RUWG9lNW56MEQzTTJYTDBVVWxlYXh3QT09OmdkWG1WMzFuMTVGOHNFNmNKOXFQVFE9P, name dGVzNS5tcDQ=' } CHUNK_SIZE = 256000 with open(FILE_PATH, 'rb') as f: tus.upload(f, TUS_ENDPOINT, headers=HEADERS, chunk_size=CHUNK_SIZE)