def post_chunk(chunk):
    if is_valid_chunk(chunk) == True:
        timestamp = chunk['timestamp'].strftime("%Y-%m-%dT%H:%M:%S.%fZ")
        gas = {'value': chunk['gas'], 'read_on': timestamp, 'token': token} + '/api/gas', json=gas)

        elec = {'value': chunk['day_elec_usage'] + chunk['night_elec_usage'], 'read_on': timestamp, 'token': token} + '/api/electricity', json=elec)

        solar = {'value': chunk['day_elec_inject'] + chunk['night_elec_inject'], 'read_on': timestamp, 'token': token} + '/api/solar', json=solar)
        print('invalid chunk')
        # print('timestamp' in chunk)
        # print('day_elec_usage' in chunk)
        # print('night_elec_usage' in chunk)
        # print('day_elec_inject' in chunk)
        # print('night_elec_inject' in chunk)
        # print('gas' in chunk)
        print('timestamp' in chunk and 'day_elec_usage' in chunk  and 'night_elec_usage' in chunk  and 'day_elec_inject' in chunk and 'night_elec_inject' in chunk and 'gas' in chunk)