Python package that acts as a wrapper for the Microsoft Graph API.
Project description
grafap
grafap (graph-wrap) is a Python package for interacting with the Microsoft Graph API, primarily sharepoint lists. Creating new items, querying lists, etc.
Installation
pip install grafap
Usage
Several environment variables are required for grafap to function. Most of the endpoints in grafap are just using the standard Microsoft Graph API which only requires a client ID and secret.
The Sharepoint REST API, however requires using a client certificate. The Sharepoint REST API is currently only used for the following functions. If you're not using them, then you don't need the certificate or the other env vars in the Sharepoint REST API table. Only the vars in the Graph table.
- "ensuring" a user in a sharepoint site.
- downloading an attachment from a sharepoint list item
MS Graph Env Vars
Env Variable | Description |
---|---|
GRAPH_LOGIN_BASE_URL | Should be https://login.microsoftonline.com/ |
GRAPH_BASE_URL | Should be https://graph.microsoft.com/v1.0/sites/ |
GRAPH_TENANT_ID | Tenant ID from app registration created in Azure. |
GRAPH_CLIENT_ID | Client ID from app registration created in Azure. |
GRAPH_CLIENT_SECRET | Client secret from app registration created in Azure. |
GRAPH_GRANT_TYPE | Should be 'client_credentials' |
GRAPH_SCOPES | Should typically be https://graph.microsoft.com/.default unless using more fine-grained permissions. |
Sharepoint Rest API Env Vars
Env Variable | Description |
---|---|
SP_SITE | Base Site URL you're interacting with. Should be https://DOMAIN.sharepoint.com/ |
SP_SCOPES | Scopes for sharepoint rest API. Should look like <https://{tenant name}.sharepoint.com/.default> |
SP_LOGIN_BASE_URL | Should be https://login.microsoftonline.com/ |
SP_TENANT_ID | Tenant ID from app registration created in Azure. |
SP_CLIENT_ID | Client ID from app registration created in Azure. |
SP_GRANT_TYPE | client_credentials |
SP_CERTIFICATE_PATH | Path to .pfx file |
SP_CERTIFICATE_PASSWORD | Password for the .pfx file. |
Examples
A few examples of using grafap functions have been added in tests/test.py
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
Built Distribution
File details
Details for the file grafap-0.1.7.tar.gz
.
File metadata
- Download URL: grafap-0.1.7.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73900089c2e445a3e3caa6ce62b3320759bfe24f7a03d3e3b1a11f662c236500 |
|
MD5 | 37447c2fa54148774fad5495c4c4a724 |
|
BLAKE2b-256 | 46636b119fd2a049880b7cb99ea7050ab2ee5c1715049a2e162fdbc6354b739b |
File details
Details for the file grafap-0.1.7-py3-none-any.whl
.
File metadata
- Download URL: grafap-0.1.7-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56c85d4282d877ab2deeed6b3454486a314165c236086b3694fcc920e0feafe6 |
|
MD5 | 399c6b198b8ea753882a18f94e95191a |
|
BLAKE2b-256 | a17e62f53ec4438cd523239a8d0e07d00dc7ad1f7865b5d931f0df1d381d79ce |