Jonathan

home

Articles

projects

tools

contact

Jonathan

Manage teams puppet accounts with python

First published:

After working with teams for a while I've found many endpoints that are critically needed are missing from the official Graph API. One of these is the ability to change the default settings for assignments in a class team. While working with other projects I built a python library to fetch tokens to use in scripts.

Package: teams-puppet

Source code: MS-Teams-Puppet-Account-Manager

The library works using a headless selenium automated browser to fetch and return the tokens. Due to the nature of the teams client it can be quite slow to fetch (30 seconds per token), but they can be used for up to an hour before expiration. The tokens are especially useful for fetching information from the APIs like delve or skype.

Example usage

import teams_puppet import requests puppet = teams_puppet.Puppet("email", "password") headers = { "accept": "application/json", "Content-Type": "application/json", "authorization": "Bearer " + puppet.get_token("teams"), "X-ClientType": "MicrosoftTeamsAngular", "X-HostAppRing": "general" } response = requests.get("https://teams.microsoft.com/api/example", headers=headers)

You can also find me on these sites

GitHubLinkedInStackOverflowEduGeekMicrosoft LearnMicrosoft CommunityCodeStats

© 2024 Jonathan