I am creating an Amazon Alexa skill in Python that would query some information from my company’s system. However, when I try to call the API that would return the access token, it shows me the error “There was a problem with the requested skill’s response.”
class LaunchRequestHandler(AbstractRequestHandler):
"""Handler for Skill Launch."""
def can_handle(self, handler_input):
return ask_utils.is_request_type("LaunchRequest")(handler_input)
def handle(self, handler_input):
username = "xxxx.xxxx"
password = "***********"
try:
response = requests.get(url="https://exemplo.com/de/url", auth=(username, password))
speak_output = f"Response: {response.text}"
except Exception as e:
speak_output = f"Exception: {e}"
return (
handler_input.response_builder
.speak(speak_output)
.ask(speak_output)
.response
)
return (
handler_input.response_builder
.speak(speak_output)
.ask(speak_output)
.response
)
I tried calling a random internet API, and it worked perfectly. I accessed the token API via Insomnia, and that also worked, so the problem isn’t with my API. I also tried using async and await, but that also generated the error.
I don’t know if Alexa requires any extra configuration to make authenticated requests, and I couldn’t find anything in the documentation.