week06
This commit is contained in:
22
env/lib/python3.12/site-packages/pyshark/config.py
vendored
Normal file
22
env/lib/python3.12/site-packages/pyshark/config.py
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
from pathlib import Path
|
||||
|
||||
from configparser import ConfigParser
|
||||
|
||||
import pyshark
|
||||
|
||||
|
||||
fp_config_path = Path.cwd() / 'config.ini' # get config from the current directory
|
||||
pyshark_config_path = Path(pyshark.__file__).parent / 'config.ini'
|
||||
|
||||
|
||||
def get_config():
|
||||
if fp_config_path.exists():
|
||||
config_path = fp_config_path
|
||||
elif pyshark_config_path.exists():
|
||||
config_path = pyshark_config_path
|
||||
else:
|
||||
return None
|
||||
|
||||
config = ConfigParser()
|
||||
config.read(config_path)
|
||||
return config
|
Reference in New Issue
Block a user