shipyard-microsoft-onedrive


Nameshipyard-microsoft-onedrive JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryA local client for working with files in Microsoft OneDrive
upload_time2024-08-01 21:07:29
maintainerNone
docs_urlNone
authorwrp801
requires_python<4.0,>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # OneDriveClient README

## Overview

`OneDriveClient` is a Python class that provides a simple interface for interacting with Microsoft OneDrive using the Microsoft Graph API. This class allows you to connect to OneDrive, upload and download files, move or rename files, and manage folders and files within a OneDrive account.

## Installation

To use the `OneDriveClient` class, you need to install:

```bash
python3 -m pip install shipyard-microsoft-onedrive
```


## Usage
#### Initialization
Create an instance of the OneDriveClient class by providing your client ID, client secret, tenant ID, and optionally, a user email.

```python 
from OneDriveClient import OneDriveClient

client = OneDriveClient(
    client_id='your_client_id',
    client_secret='your_client_secret',
    tenant='your_tenant_id',
    user_email='user_email@example.com'
)
```
#### Connecting to OneDrive 
Connect to OneDrive using the connect method. This method will acquire an access token using client credentials.
```python
client.connect()
```

#### Getting User and Drive ID
To obtain the user and drive ID associated with the credentials, run the following:
```python 
user_id = client.get_user_id()
drive_id = client.get_drive_id(user_id)
```

### Common Methods 

##### Uploading Files 
Upload a file to OneDrive using the upload method. Specify the local file path, drive ID, and the path in OneDrive where the file should be uploaded.
```python
client.upload(file_path='path/to/local/file', drive_path='path/in/onedrive', drive_id=drive_id)
```

##### Downloading Files
Download a file from OneDrive using the download method. Provide the local file path to save the file, the path in OneDrive, and the drive ID.
```python
client.download(file_path='path/to/save/file', drive_path='path/in/onedrive', drive_id=drive_id)
```

##### Moving/Renaming Files in OneDrive
Move or rename a file in OneDrive using the move method. Specify the source name, source directory, target name, target directory, and drive ID.

```python 
client.move(src_name='source_file_name', src_dir='source_directory', target_name='new_file_name', target_dir='target_directory', drive_id=drive_id)
```


##### Removing Files in OneDrive 
Remove a file from OneDrive using the remove method. Provide the path in OneDrive and the drive ID.

```python
client.remove(drive_path='path/in/onedrive', drive_id=drive_id)
```




            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "shipyard-microsoft-onedrive",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "wrp801",
    "author_email": "wespoulsen@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/94/57/ac08f6963122885dfe2fab31a5bce798089a71c2e3f528f7822bbd76d9e3/shipyard_microsoft_onedrive-0.2.0.tar.gz",
    "platform": null,
    "description": "# OneDriveClient README\n\n## Overview\n\n`OneDriveClient` is a Python class that provides a simple interface for interacting with Microsoft OneDrive using the Microsoft Graph API. This class allows you to connect to OneDrive, upload and download files, move or rename files, and manage folders and files within a OneDrive account.\n\n## Installation\n\nTo use the `OneDriveClient` class, you need to install:\n\n```bash\npython3 -m pip install shipyard-microsoft-onedrive\n```\n\n\n## Usage\n#### Initialization\nCreate an instance of the OneDriveClient class by providing your client ID, client secret, tenant ID, and optionally, a user email.\n\n```python \nfrom OneDriveClient import OneDriveClient\n\nclient = OneDriveClient(\n    client_id='your_client_id',\n    client_secret='your_client_secret',\n    tenant='your_tenant_id',\n    user_email='user_email@example.com'\n)\n```\n#### Connecting to OneDrive \nConnect to OneDrive using the connect method. This method will acquire an access token using client credentials.\n```python\nclient.connect()\n```\n\n#### Getting User and Drive ID\nTo obtain the user and drive ID associated with the credentials, run the following:\n```python \nuser_id = client.get_user_id()\ndrive_id = client.get_drive_id(user_id)\n```\n\n### Common Methods \n\n##### Uploading Files \nUpload a file to OneDrive using the upload method. Specify the local file path, drive ID, and the path in OneDrive where the file should be uploaded.\n```python\nclient.upload(file_path='path/to/local/file', drive_path='path/in/onedrive', drive_id=drive_id)\n```\n\n##### Downloading Files\nDownload a file from OneDrive using the download method. Provide the local file path to save the file, the path in OneDrive, and the drive ID.\n```python\nclient.download(file_path='path/to/save/file', drive_path='path/in/onedrive', drive_id=drive_id)\n```\n\n##### Moving/Renaming Files in OneDrive\nMove or rename a file in OneDrive using the move method. Specify the source name, source directory, target name, target directory, and drive ID.\n\n```python \nclient.move(src_name='source_file_name', src_dir='source_directory', target_name='new_file_name', target_dir='target_directory', drive_id=drive_id)\n```\n\n\n##### Removing Files in OneDrive \nRemove a file from OneDrive using the remove method. Provide the path in OneDrive and the drive ID.\n\n```python\nclient.remove(drive_path='path/in/onedrive', drive_id=drive_id)\n```\n\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A local client for working with files in Microsoft OneDrive",
    "version": "0.2.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "efabcf0c4ad0776265fed43709cb86302a9085b8c5a740c5037e45e32bafa287",
                "md5": "acbf5948672e31bf6ec1e150bbd833c8",
                "sha256": "9dfb26e458bdcf0034379835f6eb47a23d559e87bf2f16e5eb9d2a0c244fbd03"
            },
            "downloads": -1,
            "filename": "shipyard_microsoft_onedrive-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "acbf5948672e31bf6ec1e150bbd833c8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 12213,
            "upload_time": "2024-08-01T21:07:27",
            "upload_time_iso_8601": "2024-08-01T21:07:27.802380Z",
            "url": "https://files.pythonhosted.org/packages/ef/ab/cf0c4ad0776265fed43709cb86302a9085b8c5a740c5037e45e32bafa287/shipyard_microsoft_onedrive-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9457ac08f6963122885dfe2fab31a5bce798089a71c2e3f528f7822bbd76d9e3",
                "md5": "cba3e3cb91bc2f40de2a1d1dd3d093a4",
                "sha256": "e53ce3d4eb2b83ce705eb76031b7897d3ef64a428f3e93e3f94beec5cdbfb922"
            },
            "downloads": -1,
            "filename": "shipyard_microsoft_onedrive-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "cba3e3cb91bc2f40de2a1d1dd3d093a4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 8373,
            "upload_time": "2024-08-01T21:07:29",
            "upload_time_iso_8601": "2024-08-01T21:07:29.130579Z",
            "url": "https://files.pythonhosted.org/packages/94/57/ac08f6963122885dfe2fab31a5bce798089a71c2e3f528f7822bbd76d9e3/shipyard_microsoft_onedrive-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-01 21:07:29",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "shipyard-microsoft-onedrive"
}
        
Elapsed time: 0.28259s