alexa / alexa-skills-kit-sdk-for-python

The Alexa Skills Kit SDK for Python helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.
https://developer.amazon.com/en-US/docs/alexa/alexa-skills-kit-sdk-for-python/overview.html
Apache License 2.0
812 stars 206 forks source link

Python sdk lib error #161

Closed Daniyaldehleh closed 4 years ago

Daniyaldehleh commented 4 years ago

Hi there, I am trying to create a google calendar event.

class GoogleIntentHandler(AbstractRequestHandler):
    def can_handle(self, handler_input):
        return ask_utils.is_intent_name("GoogleIntent")(handler_input)

    def handle(self, handler_input):
        #LOP = request.Session.User.AccessToken
        accessToken = handler_input.request_envelope.context.System.user.access_token

        global service
        service = build('calendar', 'v3', credentials=accessToken) 

        event = {
        'summary': 'Test',
        'location': 'At home',
        'description': 'A chance to hear more about Google\'s developer products.',
        'start': {
            'dateTime': '2020-07-29T12:12:10',
            'timeZone': 'America/Los_Angeles',
        },
        'end': {
            'dateTime': '2020-07-29T12:32:47',
            'timeZone': 'America/Los_Angeles',
        }
        }
        #check if you can call a color via the api too
        event = service.events().insert(calendarId='primary', body=event).execute()

        return (
            handler_input.response_builder
            .speak(speak_output)

        )    

However, I am getting

{
  "errorMessage": "'NoneType' object has no attribute 'system'",
  "errorType": "AttributeError",
  "stackTrace": [
    "  File \"/opt/python/ask_sdk_core/skill_builder.py\", line 111, in wrapper\n    response_envelope = skill.invoke(\n",
    "  File \"/opt/python/ask_sdk_core/skill.py\", line 181, in invoke\n    api_token = request_envelope.context.system.api_access_token\n"
  ]
}

I believe the skill_builder & builder lib isn't working well. Could you please look into it?

nikhilym commented 4 years ago

Hey @danieldhz , I am closing this, since this is being discussed on our other repo : https://github.com/alexa/alexa-apis-for-python/issues/13