Skip to content

Commit 3a2dff6

Browse files
committed
Add pac file and headers support
1 parent 2133ef8 commit 3a2dff6

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/scanoss/cli.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,11 +1485,12 @@ def crypto_algorithms(parser, args):
14851485
try:
14861486
config = create_cryptography_config_from_args(args)
14871487
grpc_config = create_grpc_config_from_args(args)
1488+
if args.pac:
1489+
grpc_config.pac = get_pac_file(args.pac)
1490+
if args.header:
1491+
grpc_config.req_headers = process_req_headers(args.header)
14881492
client = ScanossGrpc(**asdict(grpc_config))
14891493

1490-
# TODO: Add PAC file support
1491-
# pac_file = get_pac_file(config.pac)
1492-
14931494
cryptography = Cryptography(config=config, client=client)
14941495
cryptography.get_algorithms()
14951496
cryptography.present(output_file=args.output)
@@ -1526,11 +1527,12 @@ def crypto_hints(parser, args):
15261527
try:
15271528
config = create_cryptography_config_from_args(args)
15281529
grpc_config = create_grpc_config_from_args(args)
1530+
if args.pac:
1531+
grpc_config.pac = get_pac_file(args.pac)
1532+
if args.header:
1533+
grpc_config.req_headers = process_req_headers(args.header)
15291534
client = ScanossGrpc(**asdict(grpc_config))
15301535

1531-
# TODO: Add PAC file support
1532-
# pac_file = get_pac_file(config.pac)
1533-
15341536
cryptography = Cryptography(config=config, client=client)
15351537
cryptography.get_encryption_hints()
15361538
cryptography.present(output_file=args.output)
@@ -1567,11 +1569,12 @@ def crypto_versions_in_range(parser, args):
15671569
try:
15681570
config = create_cryptography_config_from_args(args)
15691571
grpc_config = create_grpc_config_from_args(args)
1572+
if args.pac:
1573+
grpc_config.pac = get_pac_file(args.pac)
1574+
if args.header:
1575+
grpc_config.req_headers = process_req_headers(args.header)
15701576
client = ScanossGrpc(**asdict(grpc_config))
15711577

1572-
# TODO: Add PAC file support
1573-
# pac_file = get_pac_file(config.pac)
1574-
15751578
cryptography = Cryptography(config=config, client=client)
15761579
cryptography.get_versions_in_range()
15771580
cryptography.present(output_file=args.output)

src/scanoss/scanossgrpc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,10 +691,11 @@ class GrpcConfig:
691691
quiet: Optional[bool] = False
692692
ver_details: Optional[str] = None
693693
ca_cert: Optional[str] = None
694-
pac: Optional[PACFile] = None
695694
timeout: Optional[int] = DEFAULT_TIMEOUT
696695
proxy: Optional[str] = None
697696
grpc_proxy: Optional[str] = None
697+
pac: Optional[PACFile] = None
698+
req_headers: Optional[dict] = None
698699

699700

700701
def create_grpc_config_from_args(args) -> GrpcConfig:
@@ -706,7 +707,6 @@ def create_grpc_config_from_args(args) -> GrpcConfig:
706707
quiet=getattr(args, 'quiet', False),
707708
ver_details=getattr(args, 'ver_details', None),
708709
ca_cert=getattr(args, 'ca_cert', None),
709-
pac=getattr(args, 'pac', None),
710710
timeout=getattr(args, 'timeout', DEFAULT_TIMEOUT),
711711
proxy=getattr(args, 'proxy', None),
712712
grpc_proxy=getattr(args, 'grpc_proxy', None),

0 commit comments

Comments
 (0)