besapi 3.4.2__tar.gz → 3.7.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: besapi
3
- Version: 3.4.2
3
+ Version: 3.7.1
4
4
  Summary: Library for working with the BigFix REST API
5
5
  Home-page: https://github.com/jgstew/besapi
6
6
  Author: Matt Hansen, James Stewart
@@ -10,7 +10,7 @@ Keywords: bigfix iem tem rest api
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Operating System :: OS Independent
12
12
  Classifier: License :: OSI Approved :: MIT License
13
- Requires-Python: >=3.6
13
+ Requires-Python: >=3.7
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE.txt
16
16
  Requires-Dist: requests
@@ -8,7 +8,7 @@ classifiers =
8
8
  License :: OSI Approved :: MIT License
9
9
 
10
10
  [options]
11
- python_requires = >=3.6
11
+ python_requires = >=3.7
12
12
 
13
13
  [egg_info]
14
14
  tag_build =
@@ -29,7 +29,7 @@ import requests
29
29
  from lxml import etree, objectify
30
30
  from pkg_resources import resource_filename
31
31
 
32
- __version__ = "3.4.2"
32
+ __version__ = "3.7.1"
33
33
 
34
34
  besapi_logger = logging.getLogger("besapi")
35
35
 
@@ -1,4 +1,7 @@
1
- """This is a set of utility functions for use in multiple plugins"""
1
+ """This is a set of utility functions for use in multiple plugins
2
+
3
+ see example here: https://github.com/jgstew/besapi/blob/master/examples/export_all_sites.py
4
+ """
2
5
 
3
6
  import argparse
4
7
  import getpass
@@ -88,8 +91,10 @@ def setup_plugin_argparse(plugin_args_required=False):
88
91
  return arg_parser
89
92
 
90
93
 
91
- def setup_plugin_logging(log_file_path="", verbose=0, console=True):
92
- """setup logging for plugin use"""
94
+ def get_plugin_logging_config(log_file_path="", verbose=0, console=True):
95
+ """get config for logging for plugin use
96
+
97
+ use this like: logging.basicConfig(**logging_config)"""
93
98
 
94
99
  if not log_file_path or log_file_path == "":
95
100
  log_file_path = os.path.join(
@@ -149,6 +154,8 @@ def get_besapi_connection(args):
149
154
  # attempt bigfix connection with provided args:
150
155
  if args.user and password:
151
156
  try:
157
+ if not rest_url:
158
+ raise AttributeError
152
159
  bes_conn = besapi.besapi.BESConnection(args.user, password, rest_url)
153
160
  except (
154
161
  AttributeError,
@@ -161,7 +168,8 @@ def get_besapi_connection(args):
161
168
  args.besserver,
162
169
  )
163
170
  try:
164
- # print(args.besserver)
171
+ if not args.besserver:
172
+ raise AttributeError
165
173
  bes_conn = besapi.besapi.BESConnection(
166
174
  args.user, password, args.besserver
167
175
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: besapi
3
- Version: 3.4.2
3
+ Version: 3.7.1
4
4
  Summary: Library for working with the BigFix REST API
5
5
  Home-page: https://github.com/jgstew/besapi
6
6
  Author: Matt Hansen, James Stewart
@@ -10,7 +10,7 @@ Keywords: bigfix iem tem rest api
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Operating System :: OS Independent
12
12
  Classifier: License :: OSI Approved :: MIT License
13
- Requires-Python: >=3.6
13
+ Requires-Python: >=3.7
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE.txt
16
16
  Requires-Dist: requests
@@ -155,10 +155,22 @@ if bigfix_cli.bes_conn:
155
155
  # test plugin_utilities:
156
156
  print(besapi.plugin_utilities.get_invoke_folder())
157
157
  print(besapi.plugin_utilities.get_invoke_file_name())
158
- # the following doesn't seem to work in python 3.7:
159
- # besapi.plugin_utilities.setup_plugin_logging(console=True)
158
+
160
159
  parser = besapi.plugin_utilities.setup_plugin_argparse(plugin_args_required=False)
161
160
  # allow unknown args to be parsed instead of throwing an error:
162
161
  args, _unknown = parser.parse_known_args()
163
162
 
163
+ # test logging plugin_utilities:
164
+ import logging
165
+
166
+ logging_config = besapi.plugin_utilities.get_plugin_logging_config("./tests.log")
167
+
168
+ # this use of logging.basicConfig requires python >= 3.9
169
+ if sys.version_info >= (3, 9):
170
+ logging.basicConfig(**logging_config)
171
+
172
+ logging.warning("Just testing to see if logging is working!")
173
+
174
+ assert os.path.isfile("./tests.log")
175
+
164
176
  sys.exit(0)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes