$1.81
0 in stock
FOLDER = “inbox”TOKEN_URL = “https://login.microsoftonline.com/common/oauth2/v2.0/token”PROXIES = {“http”: “socks5://user:pass@host:port”, “https”: “socks5://user:pass@host:port”}CLIENT_ID = “”REFRESH_TOKEN = “”
# Obtain access_token via refresh_token for Microsoft Graph scopes.payload = {“client_id”: CLIENT_ID, “grant_type”: “refresh_token”, “refresh_token”: REFRESH_TOKEN, “scope”: “https://graph.microsoft.com/.default”}headers = {“Content-Type”: “application/x-www-form-urlencoded”}response = requests.post(TOKEN_URL, data=payload, headers=headers, proxies=PROXIES)access_token = response.json().get(“access_token”)
# Read messages from Inbox using Microsoft Graph API access.url = f”https://graph.microsoft.com/v1.0/me/mailFolders/{FOLDER}/messages”headers = {“Authorization”: f”Bearer {access_token}”}response = requests.get(url, headers=headers, proxies=PROXIES)messages = response.json().get(“value”, [])
# Print messagesfor msg in messages: print(f”From: {msg.get(“from”, {}).get(“emailAddress”, {}).get(“address”)}”) print(f”Subject: {msg.get(“subject”)}”) print(f”Body: {msg.get(“body”, {}).get(“content”, “”)}”)
There are no reviews yet.
You must be logged in to post a review.
There are no inquiries yet.
Reviews
There are no reviews yet.