Metadata-Version: 2.1
Name: wcpan.drive.core
Version: 1.1.0
Summary: asynchronous generic cloud drive library
Home-page: https://github.com/legnaleurc/wcpan.drive.core
Author: Wei-Cheng Pan
Author-email: legnaleurc@gmail.com
License: MIT
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.txt

# wcpan.drive

Asynchronous generic cloud drive library.

This package needs a driver to actually work with a cloud drive.

## Example Usage

```python
from wcpan.drive.core.drive import DriveFactory
from wcpan.drive.core.util import download_to_local


async def api_demo():
    # setup environment
    factory = DriveFactory()
    # read config file from here
    # default is $HOME/.config/wcpan/drive
    factory.config_path = '/tmp/config'
    # put data file to here
    # default is $HOME/.local/share/wcpan/drive
    factory.data_path = '/tmp/data'
    # setup cache database, will write to data folder
    factory.database = 'nodes.sqlite'
    # setup driver class
    factory.driver = 'wcpan.drive.google.driver.GoogleDriver'
    # load config file from config folder
    # this will not overwrite given values
    factory.load_config()

    async with factory() as drive:
        # it is important to keep cache in sync
        async for change in drive.sync():
            print(change)

        # download file
        node = await drive.get_node_by_path('/path/to/drive/file')
        download_to_local(drive, node, '/tmp')
```


