This program allows synchronize files in your local directory with remote Yandex Disk.
To begin with, you should get OAuth token. You may do this by running a method.
Get token.
cloud_connector.get_oauth_token()
Insert certain data to config.ini. I have provide example: "config.ini.template".
- Create a file - config.ini
config.ini
- Copy data from "config.ini.template".
config.ini.template
-
From (https://oauth.yandex.ru/) get ClientID and Client secret.
-
Paste them in your config.ini file.
-
Also add a name of local directory and come up with cloud directory(cloud directory will be created automatically)
-
Endless while loop is located in function - # create_folder If cloud directory is absent it will be created in Yandex Disk.
-
It is being checking whole local directory and files are being comparing with period of synchronization. The time delta is: current time - the date of modification.
delta_time = (date_time_utc - modified_local_file).seconds
if int(connection.frequency_sync_period) > delta_time / 60
Pay attention that we indicated time in minutes. In config.ini we insert just minutes for instance 1, 25, 30, 45 and etc.
-
If any file is detected then it's being reloading on remote directory.
-
If it isn't any changes that there are 2 variants:
- The file is new created so it hasn't been detected.
- The file is deleted from the local directory so it should be deleted from cloud.
-
Then we wait for difinite time.