Skip to content

Commit a6afcb8

Browse files
committed
update with new aws sentry post
1 parent 1e4a1cc commit a6afcb8

File tree

5 files changed

+27
-1
lines changed

5 files changed

+27
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Posts and associated code:
77

88
|Post|Code Directory|
99
|---|---|
10+
|[How to Monitor Python Functions on AWS Lambda with Sentry](https://www.fullstackpython.com/blog/monitor-python-functions-aws-lambda-sentry.html|[monitor-python-aws-lambda-sentry](./monitor-python-aws-lambda-sentry)|
1011
|[Using Django & AssemblyAI for More Accurate Twilio Call Transcriptions](https://www.fullstackpython.com/blog/django-accurate-twilio-voice-transcriptions.html)|[django-accurate-twilio-voice-transcriptions](./django-accurate-twilio-voice-transcriptions)|
1112
|[Higher Accuracy Twilio Voice Transcriptions with Python and Flask](https://www.fullstackpython.com/blog/accurate-twilio-voice-call-recording-transcriptions-assemblyai.html)|[accurate-twilio-voice-call-recording-transcriptions-assemblyai](./accurate-twilio-voice-call-recording-transcriptions-assemblyai)|
1213
|[Using Sentry to Handle Python Exceptions in Django Projects](https://www.fullstackpython.com/blog/sentry-handle-exceptions-django-projects.html)|[sentry-handle-exceptions-django-projects](./sentry-handle-exceptions-django-projects)|
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import json
2+
import os
3+
import sentry_sdk
4+
from sentry_sdk.integrations.aws_lambda import AwsLambdaIntegration
5+
6+
SENTRY_DSN = os.environ.get('SENTRY_DSN')
7+
sentry_sdk.init(
8+
dsn=SENTRY_DSN,
9+
integrations=[AwsLambdaIntegration()]
10+
)
11+
12+
print('Loading function')
13+
14+
15+
def lambda_handler(event, context):
16+
#print("Received event: " + json.dumps(event, indent=2))
17+
print("value1 = " + event['key1'])
18+
print("value2 = " + event['key2'])
19+
print("value3 = " + event['key3'])
20+
print("value4 = " + event['key4'])
21+
return event['key1'] # Echo back the first key value
22+
#raise Exception('Something went wrong')

transcribe-speech-text-script/get_transcription.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def get_transcription(transcription_id):
2121
args = parser.parse_args()
2222
transcription_id = args.transcription_id
2323
response_json = get_transcription(transcription_id)
24+
print(response_json)
2425
if response_json['status'] == "completed":
2526
for word in response_json['words']:
2627
print(word['text'], end=" ")

transcribe-speech-text-script/initiate_transcription.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def initiate_transcription(file_id):
1818
the results.
1919
"""
2020
endpoint = "".join([API_URL, "transcript"])
21-
json = {"audio_url": "".join([CDN_URL, "upload/{}".format(file_id)])}
21+
json = {"audio_url": "".join([CDN_URL, "upload/{}".format(file_id)]), "content_safety": "true"}
2222
headers = {
2323
"authorization": os.getenv("ASSEMBLYAI_KEY"),
2424
"content-type": "application/json"

transcribe-speech-text-script/resp.txt

Lines changed: 2 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)