Skip to main content

Perform simple tasks on OneDrive through the Graph API.

Project description

Graph-OneDrive

Interact with Microsoft's OneDrive service using the Graph API.

The Graph-OneDrive package facilitates the creation of OneDrive class instances which are objects that you can use to interact with OneDrive sessions. Thus multiple OneDrives can be connected to in parallel.

Functions include:

  • listing directories;
  • moving, copying, and renaming files and folders;
  • uploading and downloading files;
  • getting drive metadata including usage.

Azure app requirement

For the package to connect to the Graph API, you need to have an app registered in the Microsoft Azure Portal. The documentation provides basic guidance on how to register an app.

Note that some Microsoft work and school accounts will not allow apps to connect with them without admin consent.

Installation

The package currently requires Python 3.7 or greater.

Install and update using pip which will use the releases hosted on PyPI. Further options in the docs.

pip install graph-onedrive

Documentation

Documentation and examples are provided on GitHub: https://github.com/dariobauer/graph-onedrive/blob/main/docs/

A simple example

Run this command in the terminal after installation which will create a config file in the current working directory.

graph-onedrive --configure --file "config.json" --key "onedrive"

Save the following in a .py file in the same folder.

import graph_onedrive

# Set config file details
config_path = "config.json"
config_key = "onedrive"

# Create session instance
my_drive = graph_onedrive.create_from_config_file(config_path, config_key)

# Complete tasks using the instance. For example print the drive usage
my_drive.get_usage(verbose=True)

# Save the config to retain the refresh token
graph_onedrive.save_to_config_file(my_drive, config_path, config_key)

License

This project itself is subject to BSD 3-Clause License detailed in LICENSE.

The Graph API is provided by Microsoft Corporation and subject to their terms of use.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graph_onedrive-0.0.1a10.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

graph_onedrive-0.0.1a10-py2.py3-none-any.whl (17.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file graph_onedrive-0.0.1a10.tar.gz.

File metadata

  • Download URL: graph_onedrive-0.0.1a10.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for graph_onedrive-0.0.1a10.tar.gz
Algorithm Hash digest
SHA256 5daab2d02624b99c057f4bb0624412b384c2731eaa0ef4af39de3a85cda987f3
MD5 897b2ddb13812fbf327a608534fa361b
BLAKE2b-256 149430b75f9e44b71adf3e155b0ad71d02f1d18560afb5dbccc17539df79cfa8

See more details on using hashes here.

File details

Details for the file graph_onedrive-0.0.1a10-py2.py3-none-any.whl.

File metadata

  • Download URL: graph_onedrive-0.0.1a10-py2.py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for graph_onedrive-0.0.1a10-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 81a6261818f80c84c99f062bc437ba29a843137026487c70b838cae66e9775f7
MD5 a63f971d3307a8eb4afc769da4bc9c2a
BLAKE2b-256 5763bc46d4254d2b8c47b054ecdd6f1bac94ba8de2a4c345e8c1943e5c90ac48

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page