Open vgrebenschikov opened 1 year ago
as a w/a:
% git diff
diff --git a/statuscake/api/ssl_api.py b/statuscake/api/ssl_api.py
index 201917f..40f8837 100644
--- a/statuscake/api/ssl_api.py
+++ b/statuscake/api/ssl_api.py
@@ -155,7 +155,7 @@ class SslApi(object):
'user_agent': 'form',
},
'collection_format_map': {
- 'alert_at': 'csv',
+ 'alert_at': 'multi',
'contact_groups': 'csv',
}
},
diff --git a/statuscake/api_client.py b/statuscake/api_client.py
index 6261ed2..cdaf46d 100644
--- a/statuscake/api_client.py
+++ b/statuscake/api_client.py
@@ -525,7 +525,7 @@ class ApiClient(object):
if k in collection_formats:
collection_format = collection_formats[k]
if collection_format == 'multi':
- new_params.extend((k, value) for value in v)
+ new_params.extend((k + '[]', value) for value in v)
else:
if collection_format == 'ssv':
delimiter = ' '
Describe the bug Quite obvious code from example does not work:
SslApi(api_client=client).create_ssl_test(website_url='https://example.com', check_rate=86400, alert_at=[1, 2, 3])
To Reproduce Script:
Shows an error:
Expected behavior SSL test should be created, exactly same values works fine with curl:
Desktop (please complete the following information):
Additional context If turn on debug, it is seen that list of alert_at sent to server is improperly serialized (different from curl):
it first converted to string "1,2,3" then url-encoded to "alert_at=1%2C2%2C3" and then sent instead of sending as &alert_at[]=1&alert_at[]=2&alert_at[]=3