I tested the code from https://developer.cisco.com/meraki/api/#!get-organization-api-requests but received a SSL certificate error.
import meraki # Defining your API key as a variable in source code is not recommended API_KEY = '[REMOVED]' # Instead, use an environment variable as shown under the Usage section # @ https://github.com/meraki/dashboard-api-python/ dashboard = meraki.DashboardAPI(API_KEY) organization_id = '[REMOVED]' response = dashboard.api_usage.getOrganizationApiRequests( organization_id, total_pages='all' ) print(response)
Then I search around Internet and found this https://community.meraki.com/t5/Developers-APIs/Dashboard-API-via-Python-unable-to-get-local-issuer-... but how do I get the certificate? And why the file path is using double \\?
I'm unsure about your error. I just tried it in a pycharm project and it works fine here.
The double backslash is because the backslash is used as an escape character in python. So you need to escape it... with a backslash.
"The backslash (\) character is used to escape characters that otherwise have a special meaning, such as newline, backslash itself, or the quote character. String literals may optionally be prefixed with a letter `r' or `R'; such strings are called raw strings and use different rules for backslash escape sequences."
More info here:
I am just programming at the moment and I am working with the api v1.0 beta and there is no api_usage method
What version of the meraki library are you working with?
Yes, I ran that exact code with my API key and my orgId.
I'm using Python 3.7 and Meraki library 0.80.3 in a pycharm project on Windows.
ok, now I can run the code in the non-proxy environment.
But code display the Networks in terminal, so how do I pipe the output to a file like .TXT or .CSV?
Where can I find documentation for the interaction between python and Meraki API? Because I would like to try other things.
I think your best bet is to take a look at a python training course. Lots of material can be found on the internet.
Now to simply get that output into a .txt or .csv you can just add " > desiredname.txt" to the command in terminal.
python mypythonscript.py > desiredname.txt