44It is used with tabular_editor.py to run BPA.
55I did not want to re-invent the wheel, so just letting TE2 work it's magic.
66"""
7+
78import logging
89import requests as r
910import atexit
@@ -20,7 +21,8 @@ def download_bpa_file(
2021 "https://raw.githubusercontent.com/microsoft/Analysis-Services/master/BestPracticeRules/BPARules.json" # noqa: E501
2122 ),
2223 folder : str = "Best_Practice_Analyzer" ,
23- auto_remove = True ,
24+ auto_remove : bool = True ,
25+ verify : bool = False ,
2426) -> str :
2527 """Download a BPA file from local or web.
2628
@@ -34,6 +36,7 @@ def download_bpa_file(
3436 folder (str, optional): New folder string.
3537 Defaults to 'Best_Practice_Analyzer'.
3638 auto_remove (bool, optional): Auto Remove when script exits. Defaults to True.
39+ verify (bool, optional): Passthrough argument for `r.get`. Need to update later.
3740
3841 Returns:
3942 str: File path for the newly downloaded BPA.
@@ -42,7 +45,7 @@ def download_bpa_file(
4245 folder_location = os .path .join (os .getcwd (), folder )
4346 if os .path .exists (folder_location ) is False :
4447 os .makedirs (folder_location )
45- response = r .get (download_location )
48+ response = r .get (download_location , verify = verify )
4649 file_location = os .path .join (folder_location , download_location .split ("/" )[- 1 ])
4750 with open (file_location , "w" , encoding = "utf-8" ) as bpa :
4851 json .dump (response .json (), bpa , ensure_ascii = False , indent = 4 )
@@ -55,7 +58,9 @@ def download_bpa_file(
5558class BPA :
5659 """Setting BPA Class for future work..."""
5760
58- def __init__ (self , file_path : str = "Default" ) -> None :
61+ def __init__ (
62+ self , file_path : str = "Default" , verify_download : bool = True
63+ ) -> None :
5964 """BPA class to be used with the TE2 class.
6065
6166 You can create the BPA class without any arguments.
@@ -64,10 +69,12 @@ def __init__(self, file_path: str = "Default") -> None:
6469
6570 Args:
6671 file_path (str, optional): See `Download_BPA_File()`. Defaults to "Default".
72+ verify_download (bool, optional): Passthrough argument for `r.get`.
73+ Need to update later.
6774 """
6875 logger .debug (f"Initializing BPA Class:: { file_path } " )
6976 if file_path == "Default" :
70- self .location : str = download_bpa_file ()
77+ self .location : str = download_bpa_file (verify = verify_download )
7178 else :
7279 self .location : str = file_path
7380 pass
0 commit comments