msgraph2


Namemsgraph2 JSON
Version 0.4 PyPI version JSON
download
home_pageNone
SummaryA Pythonic interface to Microsoft's Graph API
upload_time2024-08-14 03:39:53
maintainerNone
docs_urlNone
authorjhunt
requires_python>=3.9
licenseThe MIT License (MIT) Copyright (c) 2024 James Hunt Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            msgraph2
========

This is a small(-ish) Python library for wrapping interactions
with Microsoft's Graph API, specifically with respect to
populating and interrogating SharePoint sites safely.

Why `msgraph2`?  Because PyPi.org doesn't allow the package name
`msgraph` because it is too similar to other (unspecified)
packages also on the index.  It was okay with msgraph2, however...

Examples
--------

```python
import msgraph2

sp = msgraph2.SafeSharePoint(
  host='yours.sharepoint.com',
  site='SITE-NAME',
  library='A Document Library',
  token=msgraph2.file_token('path/to/token.json')
)

sp.mkdir("/Incoming/Uploaded Documents", make_parents=True)
```

Where `/path/to/token.json` looks something like this:

```json
{
  "access_token": "... your access token ..."
}
```

The `msgraph2.file_token` function causes the token to be re-read
from the file every time it is needed.  Other keys in the token
JSON file will be explicitly ignored, so if you have a system of
refreshing access tokens that rewrites the on-disk file every
refresh, everything Just Works(TM).

If you are running a copy of [Oauth-Taker][1], you can point
msgraph2 there with the `msgraph2.oauth_taker_token()` helper
instead:

[1]: https://github.com/jhunt/oauth-taker

```python
import msgraph2

sp = msgraph2.SafeSharePoint(
  host='yours.sharepoint.com',
  site='SITE-NAME',
  library='A Document Library',
  token=msgraph2.oauth_taker_token(
    endpoint='https://ot.example.com/t/handler/t0',
    shared_key='my-sekrit-key-for-getting-tokens'
  )
)

sp.mkdir("/Incoming/Uploaded Documents", make_parents=True)
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "msgraph2",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "jhunt",
    "author_email": null,
    "download_url": null,
    "platform": null,
    "description": "msgraph2\n========\n\nThis is a small(-ish) Python library for wrapping interactions\nwith Microsoft's Graph API, specifically with respect to\npopulating and interrogating SharePoint sites safely.\n\nWhy `msgraph2`?  Because PyPi.org doesn't allow the package name\n`msgraph` because it is too similar to other (unspecified)\npackages also on the index.  It was okay with msgraph2, however...\n\nExamples\n--------\n\n```python\nimport msgraph2\n\nsp = msgraph2.SafeSharePoint(\n  host='yours.sharepoint.com',\n  site='SITE-NAME',\n  library='A Document Library',\n  token=msgraph2.file_token('path/to/token.json')\n)\n\nsp.mkdir(\"/Incoming/Uploaded Documents\", make_parents=True)\n```\n\nWhere `/path/to/token.json` looks something like this:\n\n```json\n{\n  \"access_token\": \"... your access token ...\"\n}\n```\n\nThe `msgraph2.file_token` function causes the token to be re-read\nfrom the file every time it is needed.  Other keys in the token\nJSON file will be explicitly ignored, so if you have a system of\nrefreshing access tokens that rewrites the on-disk file every\nrefresh, everything Just Works(TM).\n\nIf you are running a copy of [Oauth-Taker][1], you can point\nmsgraph2 there with the `msgraph2.oauth_taker_token()` helper\ninstead:\n\n[1]: https://github.com/jhunt/oauth-taker\n\n```python\nimport msgraph2\n\nsp = msgraph2.SafeSharePoint(\n  host='yours.sharepoint.com',\n  site='SITE-NAME',\n  library='A Document Library',\n  token=msgraph2.oauth_taker_token(\n    endpoint='https://ot.example.com/t/handler/t0',\n    shared_key='my-sekrit-key-for-getting-tokens'\n  )\n)\n\nsp.mkdir(\"/Incoming/Uploaded Documents\", make_parents=True)\n```\n",
    "bugtrack_url": null,
    "license": "The MIT License (MIT)  Copyright (c) 2024 James Hunt  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software..  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A Pythonic interface to Microsoft's Graph API",
    "version": "0.4",
    "project_urls": {
        "Documentation": "https://github.com/jhunt/msgraph2/blob/main/README.md",
        "Issues": "https://github.com/jhunt/msgraph2/issues",
        "Source": "https://github.com/jhunt/msgraph2"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ba0c858704a93cb45e36a841b038979b3048d2c1fb152cdbbcf8cb4de98b9427",
                "md5": "42935c9ca242c804a00f7b4fc05294df",
                "sha256": "43b67809fd5b37909e1fb6dab08b06fe275afef0a479480a1ec76a5a7e1a937f"
            },
            "downloads": -1,
            "filename": "msgraph2-0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "42935c9ca242c804a00f7b4fc05294df",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 9924,
            "upload_time": "2024-08-14T03:39:53",
            "upload_time_iso_8601": "2024-08-14T03:39:53.787368Z",
            "url": "https://files.pythonhosted.org/packages/ba/0c/858704a93cb45e36a841b038979b3048d2c1fb152cdbbcf8cb4de98b9427/msgraph2-0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-14 03:39:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jhunt",
    "github_project": "msgraph2",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "msgraph2"
}
        
Elapsed time: 0.60395s