wmgraph Microsoft Graph convenience library
This library aids with the Microsoft graph API for Office 365 business. It uses certificates for the OAuth 2.0 client credentials flow to authenticate a daemon application registered in Azure AD. This makes it suitable to be used in console applications.
Configuration
as described in A simple Python daemon console application calling Microsoft Graph with its own identity, client certificate variation
- Register an application in Azure AD
- Prepare a config.json and certificates for a MS Application
- Upload the server.crt to AAD
see Client Credentials for AzureAD msal
Create Certificates:
#!/bin/sh
openssl genrsa -out server.pem 2048
openssl req -new -key server.pem -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.pem -out server.crt
openssl x509 -noout -fingerprint -sha1 -inform pem -in server.crt |sed -e 's=:==g' > server.fpr
config.json:
{
"authority": "https://login.microsoftonline.com/TENANT_ID",
"client_id": "CLIENT_ID",
"scope": [ "https://graph.microsoft.com/.default" ],
"thumbprint": "SRERVER.CRT.FINGERPRINT",
"private_key_file": "PATH_TO_CERTS(can be relative)/server.pem",
"endpoint": "https://graph.microsoft.com/v1.0"
}
Usage
import
from wmgraph.api import MgraphApi
from wmgraph.api.exceptions import MgraphApiError
connect
api = MgraphApi(params='./config.json')
use
userdata = api.get_user(args.user_id)
or
for user in api.list_users():
print(user)`
Development requirements
twine wheel
Metadata
Release files for wmgraph 0.7.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wmgraph-0.7.1.tar.gz | 9.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wmgraph-0.7.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.5 kB
Release files / wmgraph-0.7.1.tar.gz
| Download URL | wmgraph-0.7.1.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d73b736a5e02d30618ff0a55607e07472138261d5f8a3aff3aa2d480465a0263
|
|
BLAKE2b-256 checksum How to use checksums |
7c759641365fa89155abb641de62130714cc933f38cff9e521b798e77044dd20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6
|
Release files / wmgraph-0.7.1-py3-none-any.whl
| Download URL | wmgraph-0.7.1-py3-none-any.whl |
|---|---|
| Size | 12.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a7d83246ff59fae21ec4a2320c4878cbc76b989a99197836d39e01154ee04d45
|
|
BLAKE2b-256 checksum How to use checksums |
aa3910188ad9e2409f597f34007226a1e35207a7b10c70ae382dfacb17f6fa8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6
|