Skip to content

Commit

Permalink
Fix for #214 JSON parse failure on 204 No Content response (#216)
Browse files Browse the repository at this point in the history
* Update rest_session.py

Add Python version check. 3.7 minimum required.

* Fix for #214 JSON parse failure on 204 No Content response

Fixes #214
There are very few GETs in Meraki dashboard API that produce 204 No Content, for which the Python equivalent is None, but for those that do, this change bypasses the attempt to JSON parse if the content is None, which produced an error.
  • Loading branch information
TKIPisalegacycipher authored Jun 15, 2023
1 parent 24d2bc2 commit 60183bd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion meraki/rest_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,12 @@ def _get_pages_legacy(self, metadata, url, params=None, total_pages=-1, directio
metadata['page'] = 1

response = self.request(metadata, 'GET', url, params=params)
results = response.json()

# Handle GETs that produce 204 No Content responses, e.g. getOrganizationClientSearch
if response.status_code == 204:
results = None
else:
results = response.json()

# For event log endpoint when using 'next' direction, so results/events are sorted chronologically
if type(results) == dict and metadata['operation'] == 'getNetworkEvents' and direction == 'next':
Expand Down

0 comments on commit 60183bd

Please sign in to comment.