Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in Dashboard API code - __init__() missing 1 required positional argument: 'response' #68

Closed
marianne-butaye opened this issue Feb 24, 2020 · 4 comments

Comments

@marianne-butaye
Copy link

Hello,

I often encounter this bug:

File "./app/lib/meraki_api.py", line 95, in _get_organization
dev_1         |     organizations = self.organizations.getOrganizations()
dev_1         |   File "/usr/local/lib/python3.7/site-packages/meraki/api/organizations.py", line 19, in getOrganizations
dev_1         |     return self._session.get(metadata, resource)
dev_1         |   File "/usr/local/lib/python3.7/site-packages/meraki/rest_session.py", line 142, in get
dev_1         |     response = self.request(metadata, 'GET', url, params=params)
dev_1         |   File "/usr/local/lib/python3.7/site-packages/meraki/rest_session.py", line 81, in request
dev_1         |     raise APIError(metadata)
dev_1         | TypeError: __init__() missing 1 required positional argument: 'response'

Which results from when I get this error (quite often too):

Organizations, getOrganizations - HTTPSConnectionPool(host='api.meraki.com', port=443): Max retries exceeded with url: /api/v0/organizations (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f37bd3e4390>: Failed to establish a new connection: [Errno -2] Name or service not known')), retrying in 1 second
@ozgurakcali
Copy link

I think this is a result of the fix to this issue

@shiyuechengineer
Copy link
Contributor

sorry, this should be fixed now. let me know if not please; thanks!

@marianne-butaye
Copy link
Author

Hi again, I tested with the updated package, and another error came from this bug resolution.

File "./app/lib/meraki_api.py", line 150, in _get_organization
dev_1         |     organizations = self.organizations.getOrganizations()
dev_1         |   File "/usr/local/lib/python3.7/site-packages/meraki/api/organizations.py", line 19, in getOrganizations
dev_1         |     return self._session.get(metadata, resource)
dev_1         |   File "/usr/local/lib/python3.7/site-packages/meraki/rest_session.py", line 159, in get
dev_1         |     response = self.request(metadata, 'GET', url, params=params)
dev_1         |   File "/usr/local/lib/python3.7/site-packages/meraki/rest_session.py", line 82, in request
dev_1         |     raise APIError(metadata, response)
dev_1         |   File "/usr/local/lib/python3.7/site-packages/meraki/exceptions.py", line 17, in __init__
dev_1         |     self.status = self.response.status_code
dev_1         | AttributeError: 'NoneType' object has no attribute 'status_code'

There is still an exception in file rest_session (same case as in my first message). Now that it has been corrected, response is passed correctly, but its value is None (as an error was thrown so it could not be initialized to anything else). So it throws an exception as response in APIError is assumed to be not None.

@shiyuechengineer
Copy link
Contributor

This issue should be fixed now.

This was referenced Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants