Uploads¶
Remember instance an object of FouryouseeAPI, according
to the basic set up
Getting the uploads¶
- fouryousee.FouryouseeAPI.get_uploads(self, **kwargs) List¶
Get the uploads of the 4YouSee account.
- Parameters
id (str, optional) – Id of a single upload.
- Returns
List of dicts, where every dict, depicts a upload.
- Return type
list
Usage
Once “my” object has been created. You can execute the next:
Getting all the uploads categories. It will return all the uploads of your account. It will be a list of dicts. If there is no uploads will return a empty list.
>>> my.get_uploads() [{'id': '5021b3b7c402468d5b018a8b4a2b448a', 'filename': 'sample-mp4-file.mp4'}, {'id': 'caf52322a13608e78751573ef1f94bc6', 'filename': 'sample-png-file.png'}]
If there is no uploads
>>> my.get_uploads() []
If you know the upload id
>>> my.get_uploads(id='caf52322a13608e78751573ef1f94bc6') [{'id': 'caf52322a13608e78751573ef1f94bc6', 'filename': 'sample-png-file.png'}]
If the id doesn’t exists.
>>> my.get_uploads(id='123456789abcdefghijklmnopqrstyvwxyz') []
Upload files¶
- fouryousee.FouryouseeAPI.upload_files(self, files: str) List[dict]¶
Upload a file on the 4YouSee account.
- Parameters
files (str or list, required) – Path of the file(s) locally.
- Returns
List of dicts if the file was uploaded.
- Return type
list
Usage
Once “my” object has been created. You can execute the next:
Uploading one file
>>> my.upload_files(files='/home/username/Desktop/sample-mp4-file.mp4') [{'id': '5021b3b7c402468d5b018a8b4a2b448a', 'filename': 'sample-mp4-file.mp4'}]
Uploading multiple files
>>> my.upload_files(files=['/home/username/Desktop/sample-mp4-file.mp4', ... '/home/username/Downloads/sample-jpg-file.jpg']) [{'id': '5021b3b7c402468d5b018a8b4a2b448a', 'filename': 'sample-mp4-file.mp4'}, {'id': '9db1ca3bf0b81dd30e40c721323b59a6', 'filename': 'sample-zip-file.zip'}]
If the file doens’t exist, will raise and Exception
>>> my.upload_files(files='/home/username/Desktop/file.mp4') Exception: File /home/username/Desktop/file.mp4 not found.
Deleting uploads¶
- fouryousee.FouryouseeAPI.delete_upload(self, spec_id: str)¶
Delete one upload of the 4YouSee account.
- Parameters
spec_id (str, required) – Id of a single upload.
- Returns
True in case the upload was deleted successfully or False in case the upload was not deleted.
- Return type
bool
Usage
Once “my” object has been created. You can execute the next:
>>> my.delete_upload('00fa6bba3bb250012278ae03754ad1bb') True >>> my.delete_upload('123456789abcdefghijklmnopqrstyvwxyz') # If doesn't exists False