• Sendgrid geo stats

Question related to mission SendGrid Geo Stats

 

Hello, i have trouble with this mission. In response i get empty list and i do not understand why.

this is my code:

import sendgrid    
import json
API_KEY = 'my_KEY'

def best_country(str_date):
    try:    
        sg = sendgrid.SendGridAPIClient(API_KEY)
        response = sg.client.geo.stats.get(query_params={
        'start_date':str_date,
        'end_date': str_date})
        print(response.status_code)
        print(response.body)
        print(response.headers)
        print(json.loads(response.body))
        return json.loads(response.body)
    except Exception as e:
        print(e)
        return e

if __name__ == '__main__':
    #These "asserts" using only for self-checking and not necessary for auto-testing
    print('Your best country in 2016-01-01 was ' + best_country('2016-01-01'))
    print('Check your results')

And in return i get: 200 b'[]\n' Server: nginx Date: Fri, 17 Jul 2020 12:42:08 GMT Content-Type: application/json Content-Length: 3 Connection: close X-Frame-Options: DENY Access-Control-Allow-Methods: HEAD, GET, PUT, POST, DELETE, OPTIONS, PATCH Access-Control-Max-Age: 21600 Access-Control-Expose-Headers: Link, Location Access-Control-Allow-Origin: * Access-Control-Allow-Headers: AUTHORIZATION, Content-Type, On-behalf-of, x-sg-elas-acl, X-Recaptcha, X-Request-Source Content-Security-Policy: default-src https://api.sendgrid.com; frame-src 'none'; object-src 'none' X-Content-Type-Options: nosniff Strict-Transport-Security: max-age=31536000 X-Ratelimit-Remaining: 599 X-Ratelimit-Limit: 600 X-Ratelimit-Reset: 1594989780 Powered-By: Mako

    []
    TypeError: can only concatenate str (not "list") to str
     <module>, 22