{"id":13536406,"url":"https://github.com/xybu/onedrived-dev","last_synced_at":"2025-10-03T17:31:17.996Z","repository":{"id":148552580,"uuid":"77067392","full_name":"xybu/onedrived-dev","owner":"xybu","description":"A Microsoft OneDrive client for Linux, written in Python3.","archived":true,"fork":false,"pushed_at":"2020-05-27T19:51:10.000Z","size":221,"stargazers_count":706,"open_issues_count":89,"forks_count":78,"subscribers_count":65,"default_branch":"master","last_synced_at":"2024-09-29T16:22:10.058Z","etag":null,"topics":["inotify","keyring","microsoft-onedrive","onedrive","onedrive-client","python-3","python3"],"latest_commit_sha":null,"homepage":"https://github.com/xybu/onedrived-dev","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xybu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-12-21T16:20:52.000Z","updated_at":"2024-09-14T10:13:48.000Z","dependencies_parsed_at":"2023-06-19T13:56:35.176Z","dependency_job_id":null,"html_url":"https://github.com/xybu/onedrived-dev","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xybu%2Fonedrived-dev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xybu%2Fonedrived-dev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xybu%2Fonedrived-dev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xybu%2Fonedrived-dev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xybu","download_url":"https://codeload.github.com/xybu/onedrived-dev/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235165449,"owners_count":18946239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["inotify","keyring","microsoft-onedrive","onedrive","onedrive-client","python-3","python3"],"created_at":"2024-08-01T09:00:38.673Z","updated_at":"2025-10-03T17:31:17.649Z","avatar_url":"https://github.com/xybu.png","language":"Python","readme":"# onedrived-dev\n\n[![GitHub version](https://badge.fury.io/gh/xybu%2Fonedrived-dev.svg)](https://badge.fury.io/gh/xybu%2Fonedrived-dev)\n[![Build Status](https://travis-ci.org/xybu/onedrived-dev.svg?branch=master)](https://travis-ci.org/xybu/onedrived-dev)\n[![Dependency Status](https://www.versioneye.com/user/projects/587f9689452b83003d3c8fd3/badge.svg)](https://www.versioneye.com/user/projects/587f9689452b83003d3c8fd3)\n[![License](https://img.shields.io/github/license/xybu/onedrived-dev.svg \"MIT License\")](LICENSE)\n[![codecov](https://codecov.io/gh/xybu/onedrived-dev/branch/master/graph/badge.svg)](https://codecov.io/gh/xybu/onedrived-dev)\n[![Coverage Status](https://coveralls.io/repos/github/xybu/onedrived-dev/badge.svg)](https://coveralls.io/github/xybu/onedrived-dev)\n[![Code Climate](https://codeclimate.com/github/xybu/onedrived-dev/badges/gpa.svg)](https://codeclimate.com/github/xybu/onedrived-dev)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/93853554008645059a6b17325be4fd6d)](https://www.codacy.com/app/xybu/onedrived-dev?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=xybu/onedrived-dev\u0026amp;utm_campaign=Badge_Grade)\n\n## Introduction\n\n`onedrived` is a client program for [Microsoft OneDrive](https://onedrive.com)\nfor Linux. It enables you to sync local directories with remote OneDrive\nrepositories (a.k.a., _\"Drive\"_) of one or more OneDrive  Personal account\n(OneDrive for Business accounts are not yet supported. See #1).\n\nThe program is written in Python3, and uses\n[official OneDrive Python SDK](https://github.com/OneDrive/onedrive-sdk-python)\nto communicate with OneDrive server,\n[Keyring](https://pypi.python.org/pypi/keyring) to securely store account\ncredentials, and [Linux inotify API](https://linux.die.net/man/7/inotify) to\nmonitor file system changes.\n\n**IN DEVELOPMENT. USE WITH CAUTION.**\n\n## Installation\n\nTo install `onedrived`, install all pre-requisite packages, make sure old\nversions of `onedrived` are uninstalled, and lastly install `onedrived`.\nEach of those steps will be addressed in following subsections.\n\nThe guide that follows will assume an environment with Python3 interpreter\ninstalled. To check the version of your Python3 interpreter, run command\n\n```bash\n$ python3 --version\nPython 3.5.2\n```\n\nIf `python3` command is not found, or its version is below `3.3`, please\ninstall the latest `python3` package. For example, on Ubuntu\n\n```bash\n$ sudo apt-get install python3\n```\n\nIt's strongly suggested that you\n[use the latest PIP](https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py)\nto manage Python package dependencies. To get the latest `pip` from source,\nrun command\n\n```bash\n# Download pip installation script from official site using wget.\n$ wget -O- https://bootstrap.pypa.io/get-pip.py | sudo python3\n# Upgrade the components (e.g., setuptools) to latest version.\n$ sudo pip3 install -U pip setuptools\n```\n\n### Pre-requisites\n\nThe use of low-level tools and APIs like `inotify` and `keyring` introduces\nlow-level dependencies that need to be installed manually. On Ubuntu the\nfollowing packages are needed:\n\n* `gcc`\n* `python3-dev`\n* `libssl-dev`\n* `inotify-tools`\n* `python3-dbus` (or probably `libdbus-glib-1-dev`)\n\nOn other distros like Fedora, names of those packages may vary.\n\nNote that `keyring`, which provides secure local storage for OneDrive\ncredentials (the leak of which may result in total compromise of your OneDrive\ndata), may require additional packages (for example, D-Bus or FreeDesktop\nSecret Service) depending on your Linux distro and desktop manager. Please\nrefer to its\n[installation instructions](https://pypi.python.org/pypi/keyring#installation-instructions)\nfor more details. If your environment requires `keyring.alt` package, make\nsure to use the latest version (`sudo pip3 install -U keyrings.alt`).\n\nTo install those dependencies on Ubuntu, use `apt-get` command:\n\n```bash\n# Install gcc and other C-level pre-requisites.\n$ sudo apt-get install build-essential python3-dev libssl-dev inotify-tools python3-dbus\n```\n\nPython-level pre-requisites are listed in `requirements.txt` and will be\ninstalled automatically when installing `onedrived`.\n\n### Uninstall older `onedrived`\n\nIf you have old versions of `onedrived` (also named `onedrive-d` in the\npast) in system, please uninstall them before proceeding. The packages\ncan be easily removed with `pip`.\n\n```bash\n# Remove Python packages of older onedrive-d.\n$ sudo pip3 uninstall onedrive_d onedrived\n\n# Remove useless config files.\n$ rm -rf ~/.onedrive ~/.onedrived\n```\n\n### Install `onedrived`\n\nYou can either install `onedrived` by `pip3` or pull the code and install\nmanually. Note that you may want to check out this repository regularly to\nhave the latest version installed, and run the included tests to see whether\n`onedrived` can actually run on your setup.\n\n#### Install from PyPI with `pip`\n\n`onedrived` is not yet available on PyPI.\n\n#### Install from source with `pip` (recommended)\n\nTo install latest `onedrived` from source with `pip3`, run the command below.\n\nNotes:\n\n1. `git` must be installed on the system.\n2. To install onedrived system-wide (that is, make onedrived program available\nto all users in the OS), remove argument `--user` from the command).\n\n```bash\n$ pip3 install --user git+https://github.com/xybu/onedrived-dev.git\n```\n\n#### Install from source manually\n\nFirst pull the code from GitHub repository:\n\n```bash\n$ git clone https://github.com/xybu/onedrived-dev.git\n$ cd onedrived-dev\n\n```\n\nYou may want to run the included tests before installing with one of the\nfollowing commands:\n\n```bash\n# Use the built-in test driver of Python.\n$ python3 ./setup.py test\n\n# Or use py.test if you have it installed.\n$ python3 -m pytest\n```\n\nThen install `onedrived` with one of the following command:\n\n```bash\n# Use pip to install onedrived.\n$ pip3 install -e .\n\n# Or use the built-in setuptools package from Python.\n$ python3 ./setup.py install --user\n```\n\n## Usage\n\n`onedrived` exposes two commands -- `onedrived` and `onedrived-pref`. The\nformer is the \"synchronizer\" and the latter is the \"configurator\". If you\nwant to run it directly in code repository without installing the package, in\nthe following example commands replace `onedrived` with\n`python3 -m onedrived.od_main` and replace `onedrived-pref` with\n`python3 -m onedrived.od_pref`.\n\n### Configure `onedrived`\n\nBefore running `onedrived` for the first time, or whenever you need to change\nthe configurations, you will need to use `onedrived-pref` command. The\nsubsections that follow introduces the basic usage scenarios. For more usage\nscenarios, refer to \"More Usages\" section.\n\nTo read the complete usage of `onedrived-pref`, use argument `--help`:\n\n```bash\n$ onedrived-pref --help\nUsage: od_pref.py [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --version   Show the version and exit.\n  -h, --help  Show this message and exit.\n\nCommands:\n  account  Add new OneDrive account to onedrived, list all existing ones, or\n           remove some.\n  config   Modify config (e.g., proxies, intervals) for current user.\n  drive    List all remote OneDrive repositories (Drives) of linked accounts,\n           add new Drives to sync, edit configurations of existing Drives, or\n           remove a Drive from local list.\n```\n\n#### Authorizing accounts\n\nOperations related to configuring accounts can be listed by command\n`onedrived-pref account`\n\n```bash\n$ onedrived-pref account --help\nUsage: od_pref.py account [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  -h, --help  Show this message and exit.\n\nCommands:\n  add   Add a new OneDrive account to onedrived.\n  del   De-authorize and delete an existing account from onedrived.\n  list  List all linked accounts.\n```\n\nTo add an OneDrive account to `onedrived`, you will need command\n`onedrived-pref account add`. Help message for this command is as follows:\n\n```bash\n$ onedrived-pref account add --help\nUsage: od_pref.py account add [OPTIONS]\n\nOptions:\n  -u, --get-auth-url  If set, print the authentication URL and exit.\n  -c, --code TEXT     Skip interactions and try authenticating with the code\n                      directly.\n  -b, --for-business  If set, add an OneDrive for Business account.\n  -h, --help          Show this message and exit.\n```\n\nMore specifically, the CLI offers two modes to add an account -- _interactive\nmode_, in which the CLI guides you step by step, and _command mode_, in which\nyou provide the information from command line arguments.\n\n##### Interactive mode\n\nIn interactive mode, the program will provide you with an URL to visit. Open\nthis URL with a web browser (e.g., Chrome, Firefox), sign in with your\nMicrosoft Account and authorize `onedrived` to access your OneDrive data. The\nweb page will eventually land to a blank page whose URL starts with\n\"https://login.live.com/oauth20_desktop.srf\". Paste this URL\n(a.k.a., _callback URL_) back to the program.\n\nNote that `onedrived` needs your basic account information (e.g., email\naddress) to distinguish different accounts (otherwise OneDrive returns\n\"tokens\" from which you cannot tell which account they stand for).\n\n```bash\n$ onedrived-pref account add\n\nNOTE: To better manage your OneDrive accounts, onedrived needs permission to access your account info (e.g., email\naddress to distinguish different accounts) and read/write your OneDrive files.\n\nPaste this URL into your browser to sign in and authorize onedrived:\n\nhttps://login.live.com/oauth20_authorize.srf?response_type=code\u0026scope=wl.signin+wl.emails+wl.offline_access+\nonedrive.readwrite\u0026client_id=000000004010C916\u0026redirect_uri=https%3A%2F%2Flogin.live.com%2Foauth20_desktop.srf\n\nThe authentication web page will finish with a blank page whose URL starts with\n\"https://login.live.com/oauth20_desktop.srf\". Paste this URL here.\nPaste URL here: https://login.live.com/oauth20_desktop.srf?code=\u003csome_code_here\u003e\u0026lc=1033\n\nSuccessfully authorized onedrived.\nSuccessfully added account for Xiangyu Bu (xybu92@live.com, \u003caccount_id_token\u003e)!\n\nAll OneDrive accounts associated with user \"xb\":\n\n  #  Account ID          Owner Name    Email Address\n---  ------------------  ------------  ---------------\n  0  \u003caccount_id_token\u003e  Xiangyu Bu    xybu92@live.com\n```\n\n##### Command mode\n\nInstead of giving the sign-in URL and then prompting for the callback URL, use\nthe following command to get the sign-in URL:\n\n```bash\n$ onedrived-pref account add --get-auth-url\nNOTE: To better manage your OneDrive accounts, onedrived needs permission to access your account info (e.g., email\naddress to distinguish different accounts) and read/write your OneDrive files.\n\nPaste this URL into your browser to sign in and authorize onedrived:\n\nhttps://login.live.com/oauth20_authorize.srf?response_type=code\u0026client_id=000000004010C916\u0026redirect_uri=https%3A%2F%2F\nlogin.live.com%2Foauth20_desktop.srf\u0026scope=wl.signin+wl.emails+wl.offline_access+onedrive.readwrite\n```\n\nVisit the URL and do the same steps as interactive mode until you get the\nblank page. Copy the URL and copy the `code` parameter from the URL. For\nexample, in URL\n`https://login.live.com/oauth20_desktop.srf?code=\u003csome_code_here\u003e\u0026lc=1033`,\nfind the part `?code=\u003csome_code_here\u003e\u0026` and the code is the part\n`\u003csome_code_here\u003e`.\n\nUse command `onedrived-pref account add --code \u003csome_code_here\u003e`, where\n`\u003csome_code_here\u003e` is the code, to add your account.\n\n#### Adding Drives to `onedrived`\n\nAfter you authorize `onedrived` to access your OneDrive data, you are now able\nto add Drives. Each OneDrive account has one or more Drive associated, and\n`onedrived` allows you to choose which Drive to sync. Similar to the step of\nauthorizing `onedrived`, the CLI provides both interactive mode and command\nmode.\n\n#### Interactive mode\n\n```bash\n$ onedrived-pref drive set\nReading drives information from OneDrive server...\n\nAll available Drives of authorized accounts:\n\n  #  Account Email    Drive ID          Type      Quota                        Status\n---  ---------------  ----------------  --------  ---------------------------  --------\n  0  \u003csome_email\u003e     \u003csome_drive_id\u003e   personal  5.3 GB Used / 33.0 GB Total  active\n\nPlease enter row number of the Drive to add or modify (CTRL+C to abort): 0\n\nGoing to add/edit Drive \"\u003csome_drive_id\u003e\" of account \"\u003csome_email\u003e\"...\nEnter the directory path to sync with this Drive [/home/xb/OneDrive]:  \nSyncing with directory \"/home/xb/OneDrive\"? [y/N]: y\nEnter the path to ignore file for this Drive [/home/xb/.config/onedrived/ignore_v2.txt]: \n\nSuccessfully configured Drive \u003csome_drive_id\u003e of account \u003csome_email\u003e (\u003csome_user_id\u003e):\n  Local directory: /home/xb/OneDrive\n  Ignore file path: /home/xb/.config/onedrived/ignore_v2.txt\n```\n\nIf you have more than one account authorized, all drives of all authorized\naccounts will appear in the table.\n\n#### Command mode\n\nPlease find the available command-line arguments from help message using\ncommand `onedrived-pref drive set --help`. \n\n### Set up webhook\n\n#### Webhook explained\n\nFor now, refer to issue #19. More details TBA.\n\n#### Using `ngrok`-based webhook\n\nDownload and install [ngrok](https://ngrok.com).\n\nBy default, `onedrived` will look for `ngrok` binary from `PATH`. To specify\npath to the binary manually, set up environment variable `NGROK` when running\n`onedrived`. For example, `NGROK=~/utils/ngrok onedrived start --debug`.\n\nTo use a custom config file for `ngrok`, set environment variable\n`NGROK_CONFIG_FILE` to path of your desired config file. Note that `onedrived`\nwill create a HTTPS tunnel automatically and there is no need to specify\ntunnels. The purpose of using a custom `ngrok` config file should be to adjust\nresource usage, or link `ngrok` process with your paid `ngrok` account. The\ndefault `ngrok` config file shipped with `onedrived` turns off terminal output\nof `ngrok` and disables inspection database.\n\n#### Using direct connection\n\nTBA. Not applicable to most end-user machines.\n\n### Run `onedrived` in debug mode\n\nUse argument `--debug` so that `onedrived` runs in debug mode, using\ndebug-level log verbosity and printing log to `stderr`.\n\n```bash\nonedrived start --debug\n```\n\nTo stop `onedrived` process which is running in debug mode, send `SIGINT` to\nthe process or hitting CTRL+C if it runs in a terminal.\n\n### Run `onedrived` as daemon\n\nIt's suggested that you set up a log file before running in daemon mode:\n\n```\n$ onedrived-pref config set logfile_path PATH_TO_SOME_WRITABLE_FILE\n```\n\nTo start the program as daemon,\n\n```bash\nonedrived start\n```\n\nTo stop the daemon,\n\n```bash\nonedrived stop\n```\n\nor send `SIGTERM` to the process.\n\n### More Usages\n\n#### Run `onedrived` with proxies\n\n`onedrived` follows behavior of standard Python library function\n[`getproxies()`](https://docs.python.org/3/library/urllib.request.html#urllib.request.getproxies)\nto read proxies information from the OS. That is, run the command with\nenvironment variable `HTTP_PROXY` (or `http_proxy`) to set up a HTTP proxy, and\nvariable `HTTPS_PROXY` (or `https_proxy`) to set up a HTTPS proxy. For example,\n\n```bash\n$ HTTPS_PROXY=https://user:pass@host:port/some_path onedrived start --debug\n```\n\nA HTTPS proxy must have a verifiable SSL certificate.\n\n#### List all authorized OneDrive accounts\n\n#### Remove an authorized account\n\n#### List all remote Drives\n\n#### Edit configuration of an existing Drive\n\n#### Edit ignore list (selective sync)\nThe ignore list follows the [rules of .gitignore](https://git-scm.com/docs/gitignore). For example to only sync **/foo/bar** add\n```\n/*\n!/foo\n/foo/*\n!/foo/bar\n!/foo/bar/*\n```\nThe first line means to ignore everything but the lines starting with an `!`.\n\n#### Remove a Drive from `onedrived`\n\n##### Interactive mode\n\n```bash\n$ onedrived-pref drive del\nDrives that have been set up:\n\n #0 - Drive \"\u003csome_drive_id_here\u003e\":\n   Account:     \u003csome_account_email\u003e (\u003csome_user_id_here\u003e)\n   Local root:  /home/xb/OneDrive\n   Ignore file: /home/xb/.config/onedrived/ignore_v2.txt\n\nPlease enter the # number of the Drive to delete (CTRL+C to abort): 0\nContinue to delete Drive \"\u003csome_drive_id_here\u003e\" (its local directory will NOT be deleted)? [y/N]: y\nSuccessfully deleted Drive \"\u003csome_drive_id_here\u003e\" from onedrived.\n```\n\n##### Command mode\n\nThe command-mode equivalent is:\n\n```bash\nonedrived-pref drive del --drive-id \u003csome_drive_id_here\u003e [--yes]\n```\n\nIf argument `--yes` is used, the specified Drive, if already added, will be\ndeleted without confirmation. \n\n#### Adjusting parameters of `onedrived`\n\n#### Check latest version of `onedrived`\n\n## Uninstallation\n\nUse `pip3` to uninstall `onedrived` from system:\n\n```bash\n$ pip3 uninstall onedrived\n```\n\nIf `--user` argument was not used when installing (that is, `onedrived` was\ninstalled as a system-level package), you will need root permission to run\nthe command above.\n\n## License\n\nMIT License.\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxybu%2Fonedrived-dev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxybu%2Fonedrived-dev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxybu%2Fonedrived-dev/lists"}