Giter Site home page Giter Site logo

graph-onedrive's Introduction

Tests pre-commit.ci status PyPI version Supported Python versions

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 asynchronously downloading files
  • getting file and drive metadata including usage
  • getting links to files and creating sharing links

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 -U graph-onedrive

Documentation

Documentation and examples are provided on GitHub in the docs folder.

A simple example

This is a simple example using a config file. Refer to the documentation for other instance constructors including inline options.

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

graph-onedrive --configure --authenticate -f "config.json" -k "onedrive"

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

from graph_onedrive import OneDriveManager

# Use a context manager to manage the session
with OneDriveManager(config_path="config.json", config_key="onedrive") as my_drive:

    # Print the OneDrive usage
    my_drive.get_usage(verbose=True)

    # Upload a file to the root directory
    new_file_id = my_drive.upload_file("my-photo.jpg", verbose=True)

License and Terms of Use

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

graph-onedrive's People

Contributors

dariobauer avatar pre-commit-ci[bot] avatar shub77 avatar erikvisser22 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.