python requests json Object of type datetime is not JSON serializable code example
Example: object of type 'datetime' is not json serializable
from datetime import datetime
import json
class DateTimeEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, datetime):
return o.isoformat()
return json.JSONEncoder.default(self, o)