Я пытаюсь использовать службу aws comprehend, используя мой локальный экземпляр ноутбука jupyter, установленный в Windows10.
- Я создал пользователя IAM, получил ключ доступа и секрет и добавил их в файл учетных данных.
- Я также добавил значения ключа доступа и секрета в переменные среды Windows.
- Мой код выглядит следующим образом
comprehend = boto3.client('comprehend', region_name='us-west-2') phrases = comprehend.detect_key_phrases(Text=sample_review, LanguageCode='en') print('------- phrases ---------') for i in range(0, len(phrases['KeyPhrases'])): print((phrases['KeyPhrases'][i]['Text']))
и я получаю следующую ошибку
---------------------------------------------------------------------------
ClientError Traceback (most recent call last)
<ipython-input-24-03a1f42b1c9e> in <module>
2 comprehend = boto3.client('comprehend', region_name='us-west-2')
3 # Key phrases
----> 4 phrases = comprehend.detect_key_phrases(Text=sample_review, LanguageCode='en')
5
6 # Print the phrases:
c:\python39\lib\site-packages\botocore\client.py in _api_call(self, *args, **kwargs)
355 "%s() only accepts keyword arguments." % py_operation_name)
356 # The "self" in this scope is referring to the BaseClient.
--> 357 return self._make_api_call(operation_name, kwargs)
358
359 _api_call.__name__ = str(py_operation_name)
c:\python39\lib\site-packages\botocore\client.py in _make_api_call(self, operation_name, api_params)
674 error_code = parsed_response.get("Error", {}).get("Code")
675 error_class = self.exceptions.from_code(error_code)
--> 676 raise error_class(parsed_response, operation_name)
677 else:
678 return parsed_response
ClientError: An error occurred (InvalidSignatureException) when calling the DetectKeyPhrases operation: Signature not yet current: 20201126T001510Z is still later than 20201126T001452Z (20201126T000952Z + 5 min.)