Skip to content

AttributeError: 'datetime.datetime' object has no attribute 'timestamp' in python API example #480

@ezeeetm

Description

@ezeeetm

issue in examples/aws-python-rest-api-with-dynamodb

POST - https://<my-endpoint-guid>.execute-api.us-east-1.amazonaws.com/dev/todos
returns Internal Server Error in HTTP response.

Cloudwatch logs for the Lambda function indicate:

'datetime.datetime' object has no attribute 'timestamp': AttributeError
Traceback (most recent call last):
  File "/var/task/todos/create.py", line 18, in create
    timestamp = str(datetime.utcnow().timestamp())
AttributeError: 'datetime.datetime' object has no attribute 'timestamp'

Was able to reproduce locally on Python 2.7 (same as lambda runtime). Not sure if/how this code ever worked?

PR to follow...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions