Skip to content

Instantly share code, notes, and snippets.

View prashant0085's full-sized avatar
🏠
Working from home

Prashant Tiwari prashant0085

🏠
Working from home
View GitHub Profile
@prashant0085
prashant0085 / slack_webhook_post.py
Created August 16, 2019 15:25 — forked from devStepsize/slack_webhook_post.py
POST a JSON payload to a Slack Incoming Webhook using Python requests
'''
This is an example of how to send data to Slack webhooks in Python with the
requests module.
Detailed documentation of Slack Incoming Webhooks:
https://api.slack.com/incoming-webhooks
'''
import json
import requests
from botocore.credentials import RefreshableCredentials
from botocore.session import get_session
from boto3 import Session
def assumed_session(role_arn, session_name, session=None):
"""STS Role assume a boto3.Session
With automatic credential renewal.