Skip to content

Commit 4fe03a7

Browse files
Generator improvements
* Minor improvements for library and snippets generators
1 parent ca48541 commit 4fe03a7

2 files changed

Lines changed: 17 additions & 14 deletions

File tree

generator/generate_library.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,17 @@ def generate_pagination_parameters(operation: str):
4646

4747
def check_python_version():
4848
# Check minimum Python version
49-
version_warning_string = f'The generator requires Python 3.10 at minimum. ' \
50-
f'Your interpreter version details are: \n' \
51-
f'platform.python_version_tuple()[0] = {platform.python_version_tuple()[0]}\n' \
52-
f'platform.python_version_tuple()[1] = {platform.python_version_tuple()[1]}\n' \
53-
f'platform.python_version is {platform.python_version()}\n' \
54-
f'Please consult the generator readme at your convenience: ' \
55-
f'https://github.com/meraki/dashboard-api-python/blob/main/generator/readme.md'
56-
if int(platform.python_version_tuple()[0]) != 3:
57-
sys.exit(version_warning_string)
58-
elif int(platform.python_version_tuple()[1]) < 7:
49+
version_warning_string = (
50+
f"This library generator requires Python 3.10 at minimum. "
51+
f"Your interpreter version is: {platform.python_version()}. "
52+
f"Please consult the readme at your convenience: "
53+
f"https://github.com/meraki/dashboard-api-python/blob/main/generator/readme.md "
54+
f"Additional details: "
55+
f"python_version_tuple()[0] = {platform.python_version_tuple()[0]}; "
56+
f"python_version_tuple()[1] = {platform.python_version_tuple()[1]} "
57+
)
58+
59+
if not (int(platform.python_version_tuple()[0]) == 3 and int(platform.python_version_tuple()[1]) >= 10):
5960
sys.exit(version_warning_string)
6061

6162

@@ -223,7 +224,7 @@ def generate_library(spec: dict, version_number: str, is_github_action: bool):
223224
os.mkdir(directory)
224225

225226
# Files that are not generated
226-
non_generated = ['__init__.py', 'config.py', 'exceptions.py', 'rest_session.py', 'api/__init__.py',
227+
non_generated = ['__init__.py', 'config.py', 'common.py', 'exceptions.py', 'rest_session.py', 'api/__init__.py',
227228
'aio/__init__.py', 'aio/rest_session.py', 'aio/api/__init__.py', 'api/batch/__init__.py']
228229
base_url = 'https://raw.githubusercontent.com/meraki/dashboard-api-python/master/meraki/'
229230
for file in non_generated:

generator/generate_snippets.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66

77
CALL_TEMPLATE = Template('''import meraki
88
9-
# Defining your API key as a variable in source code is not recommended
10-
API_KEY = '6bec40cf957de430a6f1f2baa056b99a4fac9ea0'
11-
# Instead, use an environment variable as shown under the Usage section
9+
# Defining your API key as a variable in source code is discouraged.
10+
# This API key is for a read-only docs-specific environment.
11+
# In your own code, use an environment variable as shown under the Usage section
1212
# @ https://github.com/meraki/dashboard-api-python/
1313
14+
API_KEY = '75dd5334bef4d2bc96f26138c163c0a3fa0b5ca6'
15+
1416
dashboard = meraki.DashboardAPI(API_KEY)
1517
{{ parameter_assignments }}
1618
response = dashboard.{{ section }}.{{ operation }}({{ parameters }})

0 commit comments

Comments
 (0)