By using AWS re:Post, you agree to the Terms of Use
/Amazon Transcribe/

Questions tagged with Amazon Transcribe

Sort by most recent
  • 1
  • 90 / page

Browse through the questions and answers listed below or filter and sort to narrow down your results.

Transcribing with HTTP and getting 404 UnknownOperationException

I followed the example in https://docs.aws.amazon.com/transcribe/latest/dg/getting-started-http-websocket.html to get a transcription job information and also followed the POST example in https://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html for signature signing. However, I am getting 404 <UnknownOperationException/> Because of legacy code, we are using python 2.7 so I cannot use AWS SDK / boto3. Here is the debug output: ``` BEGIN REQUEST++++++++++++++++++++++++++++++++++++ Request URL = https://transcribe.us-west-2.amazonaws.com/ data = {"TranscriptionJobName": "test1"} headers = {'Authorization': 'AWS4-HMAC-SHA256 Credential=********/20220419/us-west-2/transcribe/aws4_request, SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target;x-amz-security-token, Signature=*******', 'Content-Type': 'application/x-amz-json-1.0', 'X-Amz-Date': '20220419T205700Z', 'X-Amz-Target': 'com.amazonaws.transcribe.Transcribe.GetTranscriptionJob'} RESPONSE++++++++++++++++++++++++++++++++++++ Response code: 404 <UnknownOperationException/> ``` And here is the code: ``` import sys, os, base64, datetime, hashlib, hmac import requests # pip install requests import pprint # ************* REQUEST VALUES ************* method = 'POST' service = 'transcribe' host = 'transcribe.us-west-2.amazonaws.com' region = 'us-west-2' endpoint = 'https://transcribe.us-west-2.amazonaws.com/' content_type = 'application/x-amz-json-1.0' amz_target = 'com.amazonaws.transcribe.Transcribe.GetTranscriptionJob' # params for GetTranscriptionJob request_parameters1 = '{' request_parameters1 += '"TranscriptionJobName": "test1"' request_parameters1 += '}' # params for StartTranscriptionJob request_parameters2 = '{' request_parameters2 += '"TranscriptionJobName": "test2 via https",' request_parameters2 += '"IdentifyLanguage": true,' request_parameters2 += '"Media": { "MediaFileUri": "********mp3"},' request_parameters2 += '"Subtitles": true' request_parameters2 += '}' request_parameters = request_parameters1 def sign(key, msg): return hmac.new(key, msg.encode("utf-8"), hashlib.sha256).digest() def getSignatureKey(key, date_stamp, regionName, serviceName): kDate = sign(('AWS4' + key).encode('utf-8'), date_stamp) kRegion = sign(kDate, regionName) kService = sign(kRegion, serviceName) kSigning = sign(kService, 'aws4_request') return kSigning # access_key = os.environ.get('AWS_ACCESS_KEY_ID') # secret_key = os.environ.get('AWS_SECRET_ACCESS_KEY') access_key = '**************' secret_key = '**************' if access_key is None or secret_key is None: print('No access key is available.') sys.exit() # Create a date for headers and the credential string t = datetime.datetime.utcnow() amz_date = t.strftime('%Y%m%dT%H%M%SZ') date_stamp = t.strftime('%Y%m%d') # Date w/o time, used in credential scope canonical_uri = '/' canonical_querystring = '' canonical_headers = 'content-type:' + content_type + '\n' + 'host:' + host + '\n' + 'x-amz-date:' + amz_date + '\n' + 'x-amz-target:' + amz_target + '\n' signed_headers = 'content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target;x-amz-security-token' payload_hash = hashlib.sha256(request_parameters.encode('utf-8')).hexdigest() canonical_request = method + '\n' + canonical_uri + '\n' + canonical_querystring + '\n' + canonical_headers + '\n' + signed_headers + '\n' + payload_hash algorithm = 'AWS4-HMAC-SHA256' credential_scope = date_stamp + '/' + region + '/' + service + '/' + 'aws4_request' string_to_sign = algorithm + '\n' + amz_date + '\n' + credential_scope + '\n' + hashlib.sha256(canonical_request.encode('utf-8')).hexdigest() signing_key = getSignatureKey(secret_key, date_stamp, region, service) signature = hmac.new(signing_key, (string_to_sign).encode('utf-8'), hashlib.sha256).hexdigest() authorization_header = algorithm + ' ' + 'Credential=' + access_key + '/' + credential_scope + ', ' + 'SignedHeaders=' + signed_headers + ', ' + 'Signature=' + signature headers = {'Content-Type':content_type, 'X-Amz-Date':amz_date, 'X-Amz-Target':amz_target, 'Authorization':authorization_header} # ************* SEND THE REQUEST ************* print('\nBEGIN REQUEST++++++++++++++++++++++++++++++++++++') print('Request URL = ' + endpoint) print('data = ' + request_parameters) print('headers = ' + pprint.pformat(headers)) r = requests.post(endpoint, data=request_parameters, headers=headers) print('\nRESPONSE++++++++++++++++++++++++++++++++++++') print('Response code: %d\n' % r.status_code) print(r.text) ```
0
answers
0
votes
1
views
asked a month ago

Unable to resolve "Learn Python on AWS Workshop Python" error involving looping over JSON

I haven't been able to resolve the the following error that keeps showing up at the end of the [Looping over JSON](https://catalog.us-east-1.prod.workshops.aws/workshops/3d705026-9edc-40e8-b353-bdabb116c89c/en-US/loops/lab-6/step-2#looping-over-dictionaries-and-json) portion of Lab 6 in the "Learn Python on AWS Workshop" module: ``` error: the following arguments are required_ --file ``` Following the directions throughout the lab, I created the JSON file called `translate_input.json` and copied the list of dictionaries contained within. Then I created a new python file called `lab_6_step_2_loops.py` , typed in the text as directed, and ran the program with the command in the terminal python `lab_6_step_2_loops.py --file translate_input.json` after which the above error appears. I reached out to some coworkers who were also working on this but none of them have gotten back to me yet. Additionally, I've gone over all of the previous labs of this Python workshop to see what/if I missed anything, read numerous explanations, and watched several tutorials on YouTube regarding argparse and json. All of this was helpful but danced around the general issue without actually helping me resolve it but leads me to think the issue is related to the first section of the [code](https://catalog.us-east-1.prod.workshops.aws/workshops/3d705026-9edc-40e8-b353-bdabb116c89c/en-US/loops/lab-6/step-2#looping-over-dictionaries-and-json). ``` parser = argparse.ArgumentParser(description="Provides translation between one source language and another of the same set of languages.") parser.add_argument( '--file', dest='filename', help="The path to the input file. The file should be valid json", required=True) ``` Leaving this code as is, inputting the file name, file path, destination, or some combination keeps bringing up the same error as above. When I follow the directions in the link and literally just copy and paste- no typing- the text, I still come up with this error. Any thoughts?
1
answers
0
votes
5
views
asked 3 months ago

Voicemail for Amazon Connect solution -- error in TranscriptionEvents lambda

Hello, I followed the [implementation guide for the Voicemail for Amazon Connect solution](https://docs.aws.amazon.com/solutions/latest/voicemail-for-amazon-connect/welcome.html) and I'm getting the error below in the TranscriptionEventsLambda. I'm having trouble figuring out where the missing "SecretId" param should be coming from and what the value should be. I don't see that in the implementation guide. Thanks! `2022-02-09T23:08:49.594Z undefined INFO error MissingRequiredParameter: Missing required key 'SecretId' in params at ParamValidator.fail (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:50:37) at ParamValidator.validateStructure (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:61:14) at ParamValidator.validateMember (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:88:21) at ParamValidator.validate (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:34:10) at Request.VALIDATE_PARAMETERS (/var/runtime/node_modules/aws-sdk/lib/event_listeners.js:132:42) at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:106:20) at callNextListener (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:96:12) at /var/runtime/node_modules/aws-sdk/lib/event_listeners.js:86:9 at finish (/var/runtime/node_modules/aws-sdk/lib/config.js:386:7) at /var/runtime/node_modules/aws-sdk/lib/config.js:404:9 at EnvironmentCredentials.get (/var/runtime/node_modules/aws-sdk/lib/credentials.js:127:7) at getAsyncCredentials (/var/runtime/node_modules/aws-sdk/lib/config.js:398:24) at Config.getCredentials (/var/runtime/node_modules/aws-sdk/lib/config.js:418:9) at Request.VALIDATE_CREDENTIALS (/var/runtime/node_modules/aws-sdk/lib/event_listeners.js:81:26) at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:102:18) at Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:78:10) at Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:688:14) at Request.transition (/var/runtime/node_modules/aws-sdk/lib/request.js:22:10) at AcceptorStateMachine.runTo (/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12) at Request.runTo (/var/runtime/node_modules/aws-sdk/lib/request.js:408:15) at /var/runtime/node_modules/aws-sdk/lib/request.js:797:12 at new Promise (<anonymous>) { code: 'MissingRequiredParameter', time: 2022-02-09T23:08:49.532Z } `
1
answers
0
votes
5
views
asked 3 months ago

A way to increase the X-Amz-Expires from the TranscriptFileUri attribute?

On the transcribe service is there any way to increase that from the response? Here's a sample of the value of the attribute. https://s3.amazonaws.com/aws-transcribe-us-east-1-prod/231142459289/5b2d1cc2e2632/asrOutput.json?X-Amz-Security-Token=FQoDYXdzEEoaDJEZ7VTIi%2F3TqMj7UCK3A2WkUFT1pCKYVZPQY8bkBShsl9BL1pfi8QMILQG0HgojhOXluIL4retHNGi2w0C1UHoZ19BZBBKjIlsGhqmqYBDHX1OWijyl0XXlDrlaK1WMCrgBElMtAtCKo0OYgVgcF1BgRpD3iyawipS%2BL7HkxXse8AYSTaova1dgQ%2F8CrxaG0QxxlVxjxoPMPQT1bFVyd%2BBeUoDP8oCxV9SDX%2FtB7fUt2TnJCLUghgwdCC93x%2BCuhrbzyxnx3L2CIYO9oE25M4%2BkJr9uQAPvz6Bb5%2BTMtgQoMCxvlc%2BMjZFl%2F%2B5fPsvo%2BjM7emcNYRQ1ONcgmI3x2kkxGqirTA2x5qzAppsVVO5SVqaeHT5Q2uvOJL%2B7EJCgKwVgtcMd7v5uk5eo3OB6tibT0N0h5ifWlnkYGio2iH9ysJd8HwiHFDnK3DT89Q16D3l4Zj2hwodunsxXmo6J%2BxBgdJsgOBczW2vqRdTx1TpxB0wzVulP7LbeWiwUaiuC0yPakH6SXXTEWl9Tu%2FZOYN4yWsBG%2BJOJjpPmbrCoT0Dod2TsTKYslQ8xnewvbYt2KGbkekV4R4QBkp2Hm8cEnrSPeEkId%2B8o1Ne02QU%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20180622T180240Z&X-Amz-SignedHeaders=host&X-Amz-Expires=900&X-Amz-Credential=ASIAILEEXY4MGPSUDGWQ%2F20180622%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=e8855b0055c5c380bd447c8e77d9d5cdf9e64cc5c71dd5acd05c408f147b616e Notice the X-Amz-Expires=900 For some reason I'm getting a lot of Client error: `GET https://s3.amazonaws.com/aws-transcribe-us-east-1-prod/231142459289/5b2855e9974fc/asrOutput.json?truncated...` resulted in a `403 Forbidden` response: <?xml version="1.0" encoding="UTF-8"?> <Error><Code>AccessDenied</Code><Message>Request has expired</Message><X-Amz-Expi (truncated...) Any way to avoid that? thanks!
1
answers
0
votes
17
views
asked 4 years ago
  • 1
  • 90 / page