Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wmgraph

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wmgraph

Microsoft Graph convenience library

  • 0.7.1
  • PyPI
  • Socket score

Maintainers
1

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

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc