sendinblue / APIv3-python-library

SendinBlue's python library for API v3
MIT License
82 stars 40 forks source link

JSON format in single quotes instead of double quotes #70

Closed AndyGarage closed 3 years ago

AndyGarage commented 3 years ago

Hello, I've implemented the API via the official documentation on the website and noticed that the response returns in single quotes instead of the JSON double quotes format. Is this a bug or am I doing something wrong?

mukul-brevo commented 3 years ago

Hi @AndyGarage Thank you for bringing this up.

Can you please share more details on it? Like the endpoint, request payload and the response format you are getting.

melchiorEcotree commented 3 years ago

Hi, I'm having the same thing here.

Code:

`from future import print_function import time import datetime import sib_api_v3_sdk from sib_api_v3_sdk.rest import ApiException from pprint import pprint

configuration = sib_api_v3_sdk.Configuration() configuration.api_key['api-key'] = ''

api_instance = sib_api_v3_sdk.EmailCampaignsApi(sib_api_v3_sdk.ApiClient(configuration)) campaign_id = 797

api_response = api_instance.get_ab_test_campaign_result(campaign_id) print(api_response)`

Results :

{'click_rate': None, 'clicked_links': None, 'open_rate': '23.33%', 'statistics': {'clicks': {'version_a': '1.64%', 'version_b': '1%'}, 'complaints': {'version_a': '0%', 'version_b': '0%'}, 'hard_bounces': {'version_a': '1.23%', 'version_b': '1.13%'}, 'openers': {'version_a': '23.33%', 'version_b': '18.7%'}, 'soft_bounces': {'version_a': '24.56%', 'version_b': '25.47%'}, 'unsubscribed': {'version_a': '0.27%', 'version_b': '0.63%'}}, 'winning_criteria': 'Open', 'winning_subject_line': 'TEST', 'winning_version': 'A', 'winning_version_rate': '22.46%'}

mukul-brevo commented 3 years ago

Hi, I'm having the same thing here.

Code:

`from future import print_function import time import datetime import sib_api_v3_sdk from sib_api_v3_sdk.rest import ApiException from pprint import pprint

configuration = sib_api_v3_sdk.Configuration() configuration.api_key['api-key'] = ''

api_instance = sib_api_v3_sdk.EmailCampaignsApi(sib_api_v3_sdk.ApiClient(configuration)) campaign_id = 797

api_response = api_instance.get_ab_test_campaign_result(campaign_id) print(api_response)`

Results :

{'click_rate': None, 'clicked_links': None, 'open_rate': '23.33%', 'statistics': {'clicks': {'version_a': '1.64%', 'version_b': '1%'}, 'complaints': {'version_a': '0%', 'version_b': '0%'}, 'hard_bounces': {'version_a': '1.23%', 'version_b': '1.13%'}, 'openers': {'version_a': '23.33%', 'version_b': '18.7%'}, 'soft_bounces': {'version_a': '24.56%', 'version_b': '25.47%'}, 'unsubscribed': {'version_a': '0.27%', 'version_b': '0.63%'}}, 'winning_criteria': 'Open', 'winning_subject_line': 'TEST', 'winning_version': 'A', 'winning_version_rate': '22.46%'}

Hi @melchiorEcotree,

Yes the behaviour is expected, you can confirm by checking the type of api_response variable. Attributes visible can be accessed same as class attributes.

Thank you