Skip to content

Commit 805ea72

Browse files
author
Shiyue Cheng
committed
Updated with v0.11 release
1 parent 9dd2941 commit 805ea72

163 files changed

Lines changed: 797 additions & 822 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ While you can make direct HTTP requests to dashboard API in any programming lang
2424

2525
3. Install the latest version of [Python 3](ttps://wiki.python.org/moin/BeginnersGuide/NonProgrammers)
2626

27-
4. Use _pip_ (or an alternative such as _easy_install_) to install the library:
27+
4. Use _pip_ (or an alternative such as _easy_install_) to install the library from the Python [Package Index](https://pypi.org/project/meraki/):
2828
* `pip install meraki`
29-
* If you have both Python3 and Python2 installed, you may need to use `pip3 install meraki`
30-
* If _meraki_ was previously installed, you can upgrade with `pip install --upgrade meraki` or `pip3 install --upgrade meraki`
31-
* You can specify the version of the library, for example `pip install meraki==0.100.2` for v0 or `pip install meraki==1.0.0b1` for v1
29+
* If you have both Python3 and Python2 installed, you may need to use `pip3` (so `pip3 install meraki`) along with `python3` on your system
30+
* If _meraki_ was previously installed, you can upgrade to the latest stable (non-beta) release with `pip install --upgrade meraki`
31+
* You can specify the version of the library, for example `pip install meraki==0.110.0` for v0 or `pip install meraki==1.0.0b3` for v1 beta
32+
* To see the [release history](https://pypi.org/project/meraki/#history), you can also use `pip install meraki==` without including a version number
3233

3334
## Usage
3435
1. Export your API key as an [environment variable](https://www.twilio.com/blog/2017/01/how-to-set-environment-variables.html), for example:
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,13 @@
8383
from .config import (
8484
API_KEY_ENVIRONMENT_VARIABLE, DEFAULT_BASE_URL, SINGLE_REQUEST_TIMEOUT, CERTIFICATE_PATH, WAIT_ON_RATE_LIMIT,
8585
NGINX_429_RETRY_WAIT_TIME, ACTION_BATCH_RETRY_WAIT_TIME, RETRY_4XX_ERROR, RETRY_4XX_ERROR_WAIT_TIME,
86-
MAXIMUM_RETRIES, OUTPUT_LOG, LOG_PATH, LOG_FILE_PREFIX, PRINT_TO_CONSOLE, SUPPRESS_LOGGING, SIMULATE_API_CALLS
86+
MAXIMUM_RETRIES, OUTPUT_LOG, LOG_PATH, LOG_FILE_PREFIX, PRINT_TO_CONSOLE, SUPPRESS_LOGGING, SIMULATE_API_CALLS,
87+
BE_GEO_ID, MERAKI_PYTHON_SDK_CALLER
8788
)
8889

89-
__version__ = '0.100.2'
90+
91+
__version__ = '0.110.0'
92+
9093

9194
class DashboardAPI(object):
9295
"""
@@ -119,7 +122,7 @@ def __init__(self, api_key=None, base_url=DEFAULT_BASE_URL, single_request_timeo
119122
retry_4xx_error=RETRY_4XX_ERROR, retry_4xx_error_wait_time=RETRY_4XX_ERROR_WAIT_TIME,
120123
maximum_retries=MAXIMUM_RETRIES, output_log=OUTPUT_LOG, log_path=LOG_PATH,
121124
log_file_prefix=LOG_FILE_PREFIX, print_console=PRINT_TO_CONSOLE, suppress_logging=SUPPRESS_LOGGING,
122-
simulate=SIMULATE_API_CALLS, be_geo_id='', caller=''):
125+
simulate=SIMULATE_API_CALLS, be_geo_id=BE_GEO_ID, caller=MERAKI_PYTHON_SDK_CALLER):
123126
# Check API key
124127
api_key = api_key or os.environ.get(API_KEY_ENVIRONMENT_VARIABLE)
125128
if not api_key:
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,9 @@
8383
API_KEY_ENVIRONMENT_VARIABLE, DEFAULT_BASE_URL, SINGLE_REQUEST_TIMEOUT, CERTIFICATE_PATH, WAIT_ON_RATE_LIMIT,
8484
NGINX_429_RETRY_WAIT_TIME, ACTION_BATCH_RETRY_WAIT_TIME, RETRY_4XX_ERROR, RETRY_4XX_ERROR_WAIT_TIME,
8585
MAXIMUM_RETRIES, OUTPUT_LOG, LOG_PATH, LOG_FILE_PREFIX, PRINT_TO_CONSOLE, SUPPRESS_LOGGING, SIMULATE_API_CALLS,
86-
AIO_MAXIMUM_CONCURRENT_REQUESTS
86+
AIO_MAXIMUM_CONCURRENT_REQUESTS, BE_GEO_ID, MERAKI_PYTHON_SDK_CALLER
8787
)
8888

89-
__version__ = '0.100.2'
9089

9190
class AsyncDashboardAPI:
9291
"""
@@ -109,6 +108,8 @@ class AsyncDashboardAPI:
109108
- suppress_logging (boolean): disable all logging? you're on your own then!
110109
- simulate (boolean): simulate POST/PUT/DELETE calls to prevent changes?
111110
- maximum_concurrent_requests (integer): number of concurrent API requests for asynchronous class
111+
- be_geo_id (string): optional partner identifier for API usage tracking; can also be set as an environment variable BE_GEO_ID
112+
- caller (string): optional identifier for API usage tracking; can also be set as an environment variable MERAKI_PYTHON_SDK_CALLER
112113
"""
113114

114115
def __init__(self, api_key=None, base_url=DEFAULT_BASE_URL, single_request_timeout=SINGLE_REQUEST_TIMEOUT,
@@ -118,12 +119,19 @@ def __init__(self, api_key=None, base_url=DEFAULT_BASE_URL, single_request_timeo
118119
retry_4xx_error=RETRY_4XX_ERROR, retry_4xx_error_wait_time=RETRY_4XX_ERROR_WAIT_TIME,
119120
maximum_retries=MAXIMUM_RETRIES, output_log=OUTPUT_LOG, log_path=LOG_PATH,
120121
log_file_prefix=LOG_FILE_PREFIX, print_console=PRINT_TO_CONSOLE, suppress_logging=SUPPRESS_LOGGING,
121-
simulate=SIMULATE_API_CALLS, maximum_concurrent_requests=AIO_MAXIMUM_CONCURRENT_REQUESTS):
122+
simulate=SIMULATE_API_CALLS, maximum_concurrent_requests=AIO_MAXIMUM_CONCURRENT_REQUESTS,
123+
be_geo_id=BE_GEO_ID, caller=MERAKI_PYTHON_SDK_CALLER):
122124
# Check API key
123125
api_key = api_key or os.environ.get(API_KEY_ENVIRONMENT_VARIABLE)
124126
if not api_key:
125127
raise APIKeyError()
126128

129+
# Pull the BE GEO ID from an environment variable if present
130+
be_geo_id = be_geo_id or os.environ.get('BE_GEO_ID')
131+
132+
# Pull the caller from an environment variable if present
133+
caller = caller or os.environ.get('MERAKI_PYTHON_SDK_CALLER')
134+
127135
# Configure logging
128136
if not suppress_logging:
129137
self._logger = logging.getLogger(__name__)
@@ -164,7 +172,9 @@ def __init__(self, api_key=None, base_url=DEFAULT_BASE_URL, single_request_timeo
164172
retry_4xx_error_wait_time=retry_4xx_error_wait_time,
165173
maximum_retries=maximum_retries,
166174
simulate=simulate,
167-
maximum_concurrent_requests=maximum_concurrent_requests
175+
maximum_concurrent_requests=maximum_concurrent_requests,
176+
be_geo_id=be_geo_id,
177+
caller=caller,
168178
)
169179

170180
# API endpoints by section
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def __init__(self, session):
66
async def createOrganizationActionBatch(self, organizationId: str, actions: list, **kwargs):
77
"""
88
**Create an action batch**
9-
https://api.meraki.com/api_docs#create-an-action-batch
9+
https://developer.cisco.com/docs/meraki-api-v0/#!create-organization-action-batch
1010
1111
- organizationId (string)
1212
- actions (array): A set of changes to make as part of this action (<a href='https://developer.cisco.com/meraki/api/#/rest/guides/action-batches/'>more details</a>)
@@ -30,7 +30,7 @@ async def createOrganizationActionBatch(self, organizationId: str, actions: list
3030
async def getOrganizationActionBatches(self, organizationId: str):
3131
"""
3232
**Return the list of action batches in the organization**
33-
https://api.meraki.com/api_docs#return-the-list-of-action-batches-in-the-organization
33+
https://developer.cisco.com/docs/meraki-api-v0/#!get-organization-action-batches
3434
3535
- organizationId (string)
3636
"""
@@ -46,7 +46,7 @@ async def getOrganizationActionBatches(self, organizationId: str):
4646
async def getOrganizationActionBatch(self, organizationId: str, actionBatchId: str):
4747
"""
4848
**Return an action batch**
49-
https://api.meraki.com/api_docs#return-an-action-batch
49+
https://developer.cisco.com/docs/meraki-api-v0/#!get-organization-action-batch
5050
5151
- organizationId (string)
5252
- actionBatchId (string)
@@ -63,7 +63,7 @@ async def getOrganizationActionBatch(self, organizationId: str, actionBatchId: s
6363
async def deleteOrganizationActionBatch(self, organizationId: str, actionBatchId: str):
6464
"""
6565
**Delete an action batch**
66-
https://api.meraki.com/api_docs#delete-an-action-batch
66+
https://developer.cisco.com/docs/meraki-api-v0/#!delete-organization-action-batch
6767
6868
- organizationId (string)
6969
- actionBatchId (string)
@@ -80,7 +80,7 @@ async def deleteOrganizationActionBatch(self, organizationId: str, actionBatchId
8080
async def updateOrganizationActionBatch(self, organizationId: str, actionBatchId: str, **kwargs):
8181
"""
8282
**Update an action batch**
83-
https://api.meraki.com/api_docs#update-an-action-batch
83+
https://developer.cisco.com/docs/meraki-api-v0/#!update-organization-action-batch
8484
8585
- organizationId (string)
8686
- actionBatchId (string)
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def __init__(self, session):
66
async def getOrganizationAdmins(self, organizationId: str):
77
"""
88
**List the dashboard administrators in this organization**
9-
https://api.meraki.com/api_docs#list-the-dashboard-administrators-in-this-organization
9+
https://developer.cisco.com/docs/meraki-api-v0/#!get-organization-admins
1010
1111
- organizationId (string)
1212
"""
@@ -22,7 +22,7 @@ async def getOrganizationAdmins(self, organizationId: str):
2222
async def createOrganizationAdmin(self, organizationId: str, email: str, name: str, orgAccess: str, **kwargs):
2323
"""
2424
**Create a new dashboard administrator**
25-
https://api.meraki.com/api_docs#create-a-new-dashboard-administrator
25+
https://developer.cisco.com/docs/meraki-api-v0/#!create-organization-admin
2626
2727
- organizationId (string)
2828
- email (string): The email of the dashboard administrator. This attribute can not be updated.
@@ -52,7 +52,7 @@ async def createOrganizationAdmin(self, organizationId: str, email: str, name: s
5252
async def updateOrganizationAdmin(self, organizationId: str, id: str, **kwargs):
5353
"""
5454
**Update an administrator**
55-
https://api.meraki.com/api_docs#update-an-administrator
55+
https://developer.cisco.com/docs/meraki-api-v0/#!update-organization-admin
5656
5757
- organizationId (string)
5858
- id (string)
@@ -82,7 +82,7 @@ async def updateOrganizationAdmin(self, organizationId: str, id: str, **kwargs):
8282
async def deleteOrganizationAdmin(self, organizationId: str, id: str):
8383
"""
8484
**Revoke all access for a dashboard administrator within this organization**
85-
https://api.meraki.com/api_docs#revoke-all-access-for-a-dashboard-administrator-within-this-organization
85+
https://developer.cisco.com/docs/meraki-api-v0/#!delete-organization-admin
8686
8787
- organizationId (string)
8888
- id (string)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def __init__(self, session):
66
async def getNetworkAlertSettings(self, networkId: str):
77
"""
88
**Return the alert configuration for this network**
9-
https://api.meraki.com/api_docs#return-the-alert-configuration-for-this-network
9+
https://developer.cisco.com/docs/meraki-api-v0/#!get-network-alert-settings
1010
1111
- networkId (string)
1212
"""
@@ -22,7 +22,7 @@ async def getNetworkAlertSettings(self, networkId: str):
2222
async def updateNetworkAlertSettings(self, networkId: str, **kwargs):
2323
"""
2424
**Update the alert configuration for this network**
25-
https://api.meraki.com/api_docs#update-the-alert-configuration-for-this-network
25+
https://developer.cisco.com/docs/meraki-api-v0/#!update-network-alert-settings
2626
2727
- networkId (string)
2828
- defaultDestinations (object): The network-wide destinations for all alerts on the network.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def __init__(self, session):
66
async def getOrganizationApiRequests(self, organizationId: str, total_pages=1, direction='next', **kwargs):
77
"""
88
**List the API requests made by an organization**
9-
https://api.meraki.com/api_docs#list-the-api-requests-made-by-an-organization
9+
https://developer.cisco.com/docs/meraki-api-v0/#!get-organization-api-requests
1010
1111
- organizationId (string)
1212
- total_pages (integer or string): total number of pages to retrieve, -1 or "all" for all pages
@@ -41,7 +41,7 @@ async def getOrganizationApiRequests(self, organizationId: str, total_pages=1, d
4141
async def getOrganizationApiRequestsOverview(self, organizationId: str, **kwargs):
4242
"""
4343
**Return an aggregated overview of API requests data**
44-
https://api.meraki.com/api_docs#return-an-aggregated-overview-of-api-requests-data
44+
https://developer.cisco.com/docs/meraki-api-v0/#!get-organization-api-requests-overview
4545
4646
- organizationId (string)
4747
- t0 (string): The beginning of the timespan for the data. The maximum lookback period is 31 days from today.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def __init__(self, session):
66
async def getNetworkBluetoothClients(self, networkId: str, total_pages=1, direction='next', **kwargs):
77
"""
88
**List the Bluetooth clients seen by APs in this network**
9-
https://api.meraki.com/api_docs#list-the-bluetooth-clients-seen-by-aps-in-this-network
9+
https://developer.cisco.com/docs/meraki-api-v0/#!get-network-bluetooth-clients
1010
1111
- networkId (string)
1212
- total_pages (integer or string): total number of pages to retrieve, -1 or "all" for all pages
@@ -36,7 +36,7 @@ async def getNetworkBluetoothClients(self, networkId: str, total_pages=1, direct
3636
async def getNetworkBluetoothClient(self, networkId: str, bluetoothClientId: str, **kwargs):
3737
"""
3838
**Return a Bluetooth client. Bluetooth clients can be identified by their ID or their MAC.**
39-
https://api.meraki.com/api_docs#return-a-bluetooth-client
39+
https://developer.cisco.com/docs/meraki-api-v0/#!get-network-bluetooth-client
4040
4141
- networkId (string)
4242
- bluetoothClientId (string)
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def __init__(self, session):
66
async def getDeviceWirelessBluetoothSettings(self, serial: str):
77
"""
88
**Return the bluetooth settings for a wireless device**
9-
https://api.meraki.com/api_docs#return-the-bluetooth-settings-for-a-wireless-device
9+
https://developer.cisco.com/docs/meraki-api-v0/#!get-device-wireless-bluetooth-settings
1010
1111
- serial (string)
1212
"""
@@ -22,7 +22,7 @@ async def getDeviceWirelessBluetoothSettings(self, serial: str):
2222
async def updateDeviceWirelessBluetoothSettings(self, serial: str, **kwargs):
2323
"""
2424
**Update the bluetooth settings for a wireless device**
25-
https://api.meraki.com/api_docs#update-the-bluetooth-settings-for-a-wireless-device
25+
https://developer.cisco.com/docs/meraki-api-v0/#!update-device-wireless-bluetooth-settings
2626
2727
- serial (string)
2828
- uuid (string): Desired UUID of the beacon. If the value is set to null it will reset to Dashboard's automatically generated value.
@@ -46,7 +46,7 @@ async def updateDeviceWirelessBluetoothSettings(self, serial: str, **kwargs):
4646
async def getNetworkBluetoothSettings(self, networkId: str):
4747
"""
4848
**Return the Bluetooth settings for a network. <a href="https://documentation.meraki.com/MR/Bluetooth/Bluetooth_Low_Energy_(BLE)">Bluetooth settings</a> must be enabled on the network.**
49-
https://api.meraki.com/api_docs#return-the-bluetooth-settings-for-a-network
49+
https://developer.cisco.com/docs/meraki-api-v0/#!get-network-bluetooth-settings
5050
5151
- networkId (string)
5252
"""
@@ -62,7 +62,7 @@ async def getNetworkBluetoothSettings(self, networkId: str):
6262
async def updateNetworkBluetoothSettings(self, networkId: str, **kwargs):
6363
"""
6464
**Update the Bluetooth settings for a network. See the docs page for <a href="https://documentation.meraki.com/MR/Bluetooth/Bluetooth_Low_Energy_(BLE)">Bluetooth settings</a>.**
65-
https://api.meraki.com/api_docs#update-the-bluetooth-settings-for-a-network
65+
https://developer.cisco.com/docs/meraki-api-v0/#!update-network-bluetooth-settings
6666
6767
- networkId (string)
6868
- scanningEnabled (boolean): Whether APs will scan for Bluetooth enabled clients. (true, false)

0 commit comments

Comments
 (0)