{"action":"opened","issue":{"url":"https://api.github.com/repos/linode/python-linode-api/issues/100","repository_url":"https://api.github.com/repos/linode/python-linode-api","labels_url":"https://api.github.com/repos/linode/python-linode-api/issues/100/labels{/name}","comments_url":"https://api.github.com/repos/linode/python-linode-api/issues/100/comments","events_url":"https://api.github.com/repos/linode/python-linode-api/issues/100/events","html_url":"https://github.com/linode/python-linode-api/issues/100","id":302658737,"number":100,"title":"linode.errors.ApiError: 400: Invalid JSON; from null json","user":{"login":"gummiboll","id":1127811,"avatar_url":"https://avatars0.githubusercontent.com/u/1127811?v=4","gravatar_id":"","url":"https://api.github.com/users/gummiboll","html_url":"https://github.com/gummiboll","followers_url":"https://api.github.com/users/gummiboll/followers","following_url":"https://api.github.com/users/gummiboll/following{/other_user}","gists_url":"https://api.github.com/users/gummiboll/gists{/gist_id}","starred_url":"https://api.github.com/users/gummiboll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gummiboll/subscriptions","organizations_url":"https://api.github.com/users/gummiboll/orgs","repos_url":"https://api.github.com/users/gummiboll/repos","events_url":"https://api.github.com/users/gummiboll/events{/privacy}","received_events_url":"https://api.github.com/users/gummiboll/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-06T11:11:03Z","updated_at":"2018-03-06T11:11:03Z","closed_at":null,"author_association":"NONE","body":"Hello!\r\n\r\nNot really sure if this is a problem with the api-wrapper or the actual api itself since this error just started happening today and I haven't upgraded the wrapper since I last ran the same script successfully. Either way, when I use get_instances I get a stacktrace;\r\n\r\n```\r\n>>> c = linode.LinodeClient(supersecretkeygoeshere)\r\n>>> linodes = c.linode.get_instances(linode.Linode.label == 'name of a linode')\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/Users/emil/code/jenkins-scripts/env/lib/python2.7/site-packages/linode/linode_client.py\", line 31, in get_instances\r\n    return self.client._get_and_filter(Linode, *filters)\r\n  File \"/Users/emil/code/jenkins-scripts/env/lib/python2.7/site-packages/linode/linode_client.py\", line 656, in _get_and_filter\r\n    return self._get_objects(obj_type.api_list(), obj_type, filters=parsed_filters)\r\n  File \"/Users/emil/code/jenkins-scripts/env/lib/python2.7/site-packages/linode/linode_client.py\", line 487, in _get_objects\r\n    response_json = self.get(endpoint, model=model, filters=filters)\r\n  File \"/Users/emil/code/jenkins-scripts/env/lib/python2.7/site-packages/linode/linode_client.py\", line 503, in get\r\n    return self._api_call(*args, method=requests.get, **kwargs)\r\n  File \"/Users/emil/code/jenkins-scripts/env/lib/python2.7/site-packages/linode/linode_client.py\", line 477, in _api_call\r\n    raise ApiError(error_msg, status=response.status_code, json=j)\r\nlinode.errors.ApiError: 400: Invalid JSON;\r\n```\r\n\r\nAfter digging down in linode_client.py it seems like the problem happens when the client sends empty json to the api:\r\n\r\n```\r\ndef _api_call(self, endpoint, model=None, method=None, data=None, filters=None):\r\n    ....\r\n    body = json.dumps(data) # evaluates to null if data is omitted/None\r\n    response = method(url, headers=headers, data=body)\r\n\r\n```\r\nI did a simple hack to get everything up and running again (check if data is None and if it is don't send the body through method() and that works but feels pretty hackish."}}
{"actor":{"display_login":"gummiboll"}}