Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created September 19, 2020 05:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/fc6671b898a407dedbd82baa61dc45c0 to your computer and use it in GitHub Desktop.
Save amankharwal/fc6671b898a407dedbd82baa61dc45c0 to your computer and use it in GitHub Desktop.
def send_slack(transcript,filename,keyword):
try:
response = requests.post( url="https://hooks.slack.com/services/ABCDEFG/123456/ABC123",
headers={
"Content-Type": "application/json",
},
data=json.dumps({
"text": "*Audio:* https://storage.cloud.google.com/" + BucketName + "/" + filename + "\n*Transcription:*\n" + transcript
})
)
print('Response HTTP Status Code: {status_code}'.format(
status_code=response.status_code))
print('Response HTTP Response Body: {content}'.format(
content=response.content))
except requests.exceptions.RequestException:
print('HTTP Request failed')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment