Media Storage Python Library for Ricoh API.
You need
- Ricoh API Client Credentials (client_id & client_secret)
- Ricoh ID (user_id & password)
If you don't have them, please register yourself and your client from THETA Developers Website.
Befor install, you must install auth-py
$ pip install --upgrade git+https://github.com/ricohapi/media-storage-py.git
from ricohapi.mstorage.client import MediaStorage
from ricohapi.auth.client import AuthClient
aclient = AuthClient('<your_client_id>', '<your_client_secret>')
aclient.set_resource_owner_creds('<your_user_id>', '<your_password>')
mstorage = MediaStorage(aclient)
mstorage.connect()
print(mstorage.upload('./upload_file_path.jpg'))
aclient = AuthClient('<your_client_id>', '<your_client_secret>')
aclient.set_resource_owner_creds('<your_user_id>', '<your_password>')
mstorage = MediaStorage(<AuthClient object>)
mstorage.connect()
mstorage.upload('./upload_file_path.jpg')
mstorage.download_to('<media_id>', './download_file_path.jpg')
mstorage.download('<media_id>')
mstorage.list()
mstorage.list({'limit': 25, 'after': '<cursor-id>'})
mstorage.delete('<media_id>')
mstorage.info('<media_id>')
mstorage.meta('<media_id>')
mstorage.meta('<media_id>', 'user')
mstorage.meta('<media_id>', 'user.<key>')
mstorage.meta('<media_id>', 'exif')
mstorage.meta('<media_id>', 'gpano')
Existing metadata value for the same key will be overwritten. Up to 10 user metadata can be attached to a media data.
mstorage.add_meta('<media_id>', { 'user.<key1>' : '<value1>', 'user.<key2>' : '<value2>', ...})
mstorage.remove_meta('<media_id>', 'user.<key>')
mstorage.remove_meta('<media_id>', 'user')
return media ids which have all key value pairs
mstorage.list({'limit': 25, 'after': '<cursor-id>', 'filter': { 'meta.user.<key1>' : '<value1>', 'meta.user.<key2>' : '<value2>', ...}})