Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import inotify.adapters
- from minio import Minio
- from minio.error import ResponseError
- minioClient = Minio('play.minio.io:9000',
- access_key='Q3AM3UQ867SPQQA43P2F',
- secret_key='zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',
- secure=True)
- def _main():
- i = inotify.adapters.Inotify()
- i.add_watch(b'/tmp/1')
- try:
- for event in i.event_gen():
- if event is not None:
- (header, type_names, watch_path, filename) = event
- if type_names[0] is 'IN_CLOSE_WRITE':
- print(minioClient.fput_object('testbucket', filename, watch_path+'/'+filename))
- finally:
- i.remove_watch(b'/tmp/1')
- if __name__ == '__main__':
- _main()
Add Comment
Please, Sign In to add comment