scanoss 1.22.0__py3-none-any.whl → 1.23.0__py3-none-any.whl
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.
- scanoss/__init__.py +1 -1
- scanoss/api/geoprovenance/v2/scanoss_geoprovenance_pb2.py +49 -0
- scanoss/api/geoprovenance/v2/scanoss_geoprovenance_pb2_grpc.py +142 -0
- scanoss/cli.py +11 -6
- scanoss/components.py +21 -11
- scanoss/data/build_date.txt +1 -1
- scanoss/scanners/scanner_hfh.py +2 -1
- scanoss/scanossgrpc.py +28 -14
- {scanoss-1.22.0.dist-info → scanoss-1.23.0.dist-info}/METADATA +1 -1
- {scanoss-1.22.0.dist-info → scanoss-1.23.0.dist-info}/RECORD +16 -16
- {scanoss-1.22.0.dist-info → scanoss-1.23.0.dist-info}/WHEEL +1 -1
- scanoss/api/provenance/v2/scanoss_provenance_pb2.py +0 -41
- scanoss/api/provenance/v2/scanoss_provenance_pb2_grpc.py +0 -108
- /scanoss/api/{provenance → geoprovenance}/__init__.py +0 -0
- /scanoss/api/{provenance → geoprovenance}/v2/__init__.py +0 -0
- {scanoss-1.22.0.dist-info → scanoss-1.23.0.dist-info}/entry_points.txt +0 -0
- {scanoss-1.22.0.dist-info → scanoss-1.23.0.dist-info}/licenses/LICENSE +0 -0
- {scanoss-1.22.0.dist-info → scanoss-1.23.0.dist-info}/top_level.txt +0 -0
scanoss/__init__.py
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: scanoss/api/geoprovenance/v2/scanoss-geoprovenance.proto
|
|
4
|
+
"""Generated protocol buffer code."""
|
|
5
|
+
from google.protobuf.internal import builder as _builder
|
|
6
|
+
from google.protobuf import descriptor as _descriptor
|
|
7
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
8
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
9
|
+
# @@protoc_insertion_point(imports)
|
|
10
|
+
|
|
11
|
+
_sym_db = _symbol_database.Default()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
from scanoss.api.common.v2 import scanoss_common_pb2 as scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2
|
|
15
|
+
from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
|
|
16
|
+
from protoc_gen_swagger.options import annotations_pb2 as protoc__gen__swagger_dot_options_dot_annotations__pb2
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n8scanoss/api/geoprovenance/v2/scanoss-geoprovenance.proto\x12\x1cscanoss.api.geoprovenance.v2\x1a*scanoss/api/common/v2/scanoss-common.proto\x1a\x1cgoogle/api/annotations.proto\x1a,protoc-gen-swagger/options/annotations.proto\"\xd1\x03\n\x13\x43ontributorResponse\x12\x46\n\x05purls\x18\x01 \x03(\x0b\x32\x37.scanoss.api.geoprovenance.v2.ContributorResponse.Purls\x12\x35\n\x06status\x18\x02 \x01(\x0b\x32%.scanoss.api.common.v2.StatusResponse\x1a\x32\n\x10\x44\x65\x63laredLocation\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x10\n\x08location\x18\x02 \x01(\t\x1a\x31\n\x0f\x43uratedLocation\x12\x0f\n\x07\x63ountry\x18\x01 \x01(\t\x12\r\n\x05\x63ount\x18\x02 \x01(\x05\x1a\xd3\x01\n\x05Purls\x12\x0c\n\x04purl\x18\x01 \x01(\t\x12^\n\x12\x64\x65\x63lared_locations\x18\x02 \x03(\x0b\x32\x42.scanoss.api.geoprovenance.v2.ContributorResponse.DeclaredLocation\x12\\\n\x11\x63urated_locations\x18\x03 \x03(\x0b\x32\x41.scanoss.api.geoprovenance.v2.ContributorResponse.CuratedLocation\"\x99\x02\n\x0eOriginResponse\x12\x41\n\x05purls\x18\x01 \x03(\x0b\x32\x32.scanoss.api.geoprovenance.v2.OriginResponse.Purls\x12\x35\n\x06status\x18\x02 \x01(\x0b\x32%.scanoss.api.common.v2.StatusResponse\x1a,\n\x08Location\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\npercentage\x18\x02 \x01(\x02\x1a_\n\x05Purls\x12\x0c\n\x04purl\x18\x01 \x01(\t\x12H\n\tlocations\x18\x02 \x03(\x0b\x32\x35.scanoss.api.geoprovenance.v2.OriginResponse.Location2\xb9\x03\n\rGeoProvenance\x12v\n\x04\x45\x63ho\x12\".scanoss.api.common.v2.EchoRequest\x1a#.scanoss.api.common.v2.EchoResponse\"%\x82\xd3\xe4\x93\x02\x1f\"\x1a/api/v2/geoprovenance/echo:\x01*\x12\x9d\x01\n\x18GetComponentContributors\x12\".scanoss.api.common.v2.PurlRequest\x1a\x31.scanoss.api.geoprovenance.v2.ContributorResponse\"*\x82\xd3\xe4\x93\x02$\"\x1f/api/v2/geoprovenance/countries:\x01*\x12\x8f\x01\n\x12GetComponentOrigin\x12\".scanoss.api.common.v2.PurlRequest\x1a,.scanoss.api.geoprovenance.v2.OriginResponse\"\'\x82\xd3\xe4\x93\x02!\"\x1c/api/v2/geoprovenance/origin:\x01*B\xa4\x02Z;github.com/scanoss/papi/api/geoprovenancev2;geoprovenancev2\x92\x41\xe3\x01\x12}\n\x1eSCANOSS GEO Provenance Service\"V\n\x15scanoss-geoprovenance\x12(https://github.com/scanoss/geoprovenance\x1a\x13support@scanoss.com2\x03\x32.0*\x01\x01\x32\x10\x61pplication/json:\x10\x61pplication/jsonR;\n\x03\x34\x30\x34\x12\x34\n*Returned when the resource does not exist.\x12\x06\n\x04\x9a\x02\x01\x07\x62\x06proto3')
|
|
20
|
+
|
|
21
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
|
|
22
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'scanoss.api.geoprovenance.v2.scanoss_geoprovenance_pb2', globals())
|
|
23
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
24
|
+
|
|
25
|
+
DESCRIPTOR._options = None
|
|
26
|
+
DESCRIPTOR._serialized_options = b'Z;github.com/scanoss/papi/api/geoprovenancev2;geoprovenancev2\222A\343\001\022}\n\036SCANOSS GEO Provenance Service\"V\n\025scanoss-geoprovenance\022(https://github.com/scanoss/geoprovenance\032\023support@scanoss.com2\0032.0*\001\0012\020application/json:\020application/jsonR;\n\003404\0224\n*Returned when the resource does not exist.\022\006\n\004\232\002\001\007'
|
|
27
|
+
_GEOPROVENANCE.methods_by_name['Echo']._options = None
|
|
28
|
+
_GEOPROVENANCE.methods_by_name['Echo']._serialized_options = b'\202\323\344\223\002\037\"\032/api/v2/geoprovenance/echo:\001*'
|
|
29
|
+
_GEOPROVENANCE.methods_by_name['GetComponentContributors']._options = None
|
|
30
|
+
_GEOPROVENANCE.methods_by_name['GetComponentContributors']._serialized_options = b'\202\323\344\223\002$\"\037/api/v2/geoprovenance/countries:\001*'
|
|
31
|
+
_GEOPROVENANCE.methods_by_name['GetComponentOrigin']._options = None
|
|
32
|
+
_GEOPROVENANCE.methods_by_name['GetComponentOrigin']._serialized_options = b'\202\323\344\223\002!\"\034/api/v2/geoprovenance/origin:\001*'
|
|
33
|
+
_CONTRIBUTORRESPONSE._serialized_start=211
|
|
34
|
+
_CONTRIBUTORRESPONSE._serialized_end=676
|
|
35
|
+
_CONTRIBUTORRESPONSE_DECLAREDLOCATION._serialized_start=361
|
|
36
|
+
_CONTRIBUTORRESPONSE_DECLAREDLOCATION._serialized_end=411
|
|
37
|
+
_CONTRIBUTORRESPONSE_CURATEDLOCATION._serialized_start=413
|
|
38
|
+
_CONTRIBUTORRESPONSE_CURATEDLOCATION._serialized_end=462
|
|
39
|
+
_CONTRIBUTORRESPONSE_PURLS._serialized_start=465
|
|
40
|
+
_CONTRIBUTORRESPONSE_PURLS._serialized_end=676
|
|
41
|
+
_ORIGINRESPONSE._serialized_start=679
|
|
42
|
+
_ORIGINRESPONSE._serialized_end=960
|
|
43
|
+
_ORIGINRESPONSE_LOCATION._serialized_start=819
|
|
44
|
+
_ORIGINRESPONSE_LOCATION._serialized_end=863
|
|
45
|
+
_ORIGINRESPONSE_PURLS._serialized_start=865
|
|
46
|
+
_ORIGINRESPONSE_PURLS._serialized_end=960
|
|
47
|
+
_GEOPROVENANCE._serialized_start=963
|
|
48
|
+
_GEOPROVENANCE._serialized_end=1404
|
|
49
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
+
import grpc
|
|
4
|
+
|
|
5
|
+
from scanoss.api.common.v2 import scanoss_common_pb2 as scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2
|
|
6
|
+
from scanoss.api.geoprovenance.v2 import scanoss_geoprovenance_pb2 as scanoss_dot_api_dot_geoprovenance_dot_v2_dot_scanoss__geoprovenance__pb2
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class GeoProvenanceStub(object):
|
|
10
|
+
"""*
|
|
11
|
+
Expose all of the SCANOSS Geo Provenance RPCs here
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def __init__(self, channel):
|
|
15
|
+
"""Constructor.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
channel: A grpc.Channel.
|
|
19
|
+
"""
|
|
20
|
+
self.Echo = channel.unary_unary(
|
|
21
|
+
'/scanoss.api.geoprovenance.v2.GeoProvenance/Echo',
|
|
22
|
+
request_serializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.EchoRequest.SerializeToString,
|
|
23
|
+
response_deserializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.EchoResponse.FromString,
|
|
24
|
+
)
|
|
25
|
+
self.GetComponentContributors = channel.unary_unary(
|
|
26
|
+
'/scanoss.api.geoprovenance.v2.GeoProvenance/GetComponentContributors',
|
|
27
|
+
request_serializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.PurlRequest.SerializeToString,
|
|
28
|
+
response_deserializer=scanoss_dot_api_dot_geoprovenance_dot_v2_dot_scanoss__geoprovenance__pb2.ContributorResponse.FromString,
|
|
29
|
+
)
|
|
30
|
+
self.GetComponentOrigin = channel.unary_unary(
|
|
31
|
+
'/scanoss.api.geoprovenance.v2.GeoProvenance/GetComponentOrigin',
|
|
32
|
+
request_serializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.PurlRequest.SerializeToString,
|
|
33
|
+
response_deserializer=scanoss_dot_api_dot_geoprovenance_dot_v2_dot_scanoss__geoprovenance__pb2.OriginResponse.FromString,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class GeoProvenanceServicer(object):
|
|
38
|
+
"""*
|
|
39
|
+
Expose all of the SCANOSS Geo Provenance RPCs here
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
def Echo(self, request, context):
|
|
43
|
+
"""Standard echo
|
|
44
|
+
"""
|
|
45
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
46
|
+
context.set_details('Method not implemented!')
|
|
47
|
+
raise NotImplementedError('Method not implemented!')
|
|
48
|
+
|
|
49
|
+
def GetComponentContributors(self, request, context):
|
|
50
|
+
"""Get component-level Geo Provenance based on contributor declared location
|
|
51
|
+
"""
|
|
52
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
53
|
+
context.set_details('Method not implemented!')
|
|
54
|
+
raise NotImplementedError('Method not implemented!')
|
|
55
|
+
|
|
56
|
+
def GetComponentOrigin(self, request, context):
|
|
57
|
+
"""Get component-level Geo Provenance based on contributor origin commit times
|
|
58
|
+
"""
|
|
59
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
60
|
+
context.set_details('Method not implemented!')
|
|
61
|
+
raise NotImplementedError('Method not implemented!')
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def add_GeoProvenanceServicer_to_server(servicer, server):
|
|
65
|
+
rpc_method_handlers = {
|
|
66
|
+
'Echo': grpc.unary_unary_rpc_method_handler(
|
|
67
|
+
servicer.Echo,
|
|
68
|
+
request_deserializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.EchoRequest.FromString,
|
|
69
|
+
response_serializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.EchoResponse.SerializeToString,
|
|
70
|
+
),
|
|
71
|
+
'GetComponentContributors': grpc.unary_unary_rpc_method_handler(
|
|
72
|
+
servicer.GetComponentContributors,
|
|
73
|
+
request_deserializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.PurlRequest.FromString,
|
|
74
|
+
response_serializer=scanoss_dot_api_dot_geoprovenance_dot_v2_dot_scanoss__geoprovenance__pb2.ContributorResponse.SerializeToString,
|
|
75
|
+
),
|
|
76
|
+
'GetComponentOrigin': grpc.unary_unary_rpc_method_handler(
|
|
77
|
+
servicer.GetComponentOrigin,
|
|
78
|
+
request_deserializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.PurlRequest.FromString,
|
|
79
|
+
response_serializer=scanoss_dot_api_dot_geoprovenance_dot_v2_dot_scanoss__geoprovenance__pb2.OriginResponse.SerializeToString,
|
|
80
|
+
),
|
|
81
|
+
}
|
|
82
|
+
generic_handler = grpc.method_handlers_generic_handler(
|
|
83
|
+
'scanoss.api.geoprovenance.v2.GeoProvenance', rpc_method_handlers)
|
|
84
|
+
server.add_generic_rpc_handlers((generic_handler,))
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
# This class is part of an EXPERIMENTAL API.
|
|
88
|
+
class GeoProvenance(object):
|
|
89
|
+
"""*
|
|
90
|
+
Expose all of the SCANOSS Geo Provenance RPCs here
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
@staticmethod
|
|
94
|
+
def Echo(request,
|
|
95
|
+
target,
|
|
96
|
+
options=(),
|
|
97
|
+
channel_credentials=None,
|
|
98
|
+
call_credentials=None,
|
|
99
|
+
insecure=False,
|
|
100
|
+
compression=None,
|
|
101
|
+
wait_for_ready=None,
|
|
102
|
+
timeout=None,
|
|
103
|
+
metadata=None):
|
|
104
|
+
return grpc.experimental.unary_unary(request, target, '/scanoss.api.geoprovenance.v2.GeoProvenance/Echo',
|
|
105
|
+
scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.EchoRequest.SerializeToString,
|
|
106
|
+
scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.EchoResponse.FromString,
|
|
107
|
+
options, channel_credentials,
|
|
108
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
109
|
+
|
|
110
|
+
@staticmethod
|
|
111
|
+
def GetComponentContributors(request,
|
|
112
|
+
target,
|
|
113
|
+
options=(),
|
|
114
|
+
channel_credentials=None,
|
|
115
|
+
call_credentials=None,
|
|
116
|
+
insecure=False,
|
|
117
|
+
compression=None,
|
|
118
|
+
wait_for_ready=None,
|
|
119
|
+
timeout=None,
|
|
120
|
+
metadata=None):
|
|
121
|
+
return grpc.experimental.unary_unary(request, target, '/scanoss.api.geoprovenance.v2.GeoProvenance/GetComponentContributors',
|
|
122
|
+
scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.PurlRequest.SerializeToString,
|
|
123
|
+
scanoss_dot_api_dot_geoprovenance_dot_v2_dot_scanoss__geoprovenance__pb2.ContributorResponse.FromString,
|
|
124
|
+
options, channel_credentials,
|
|
125
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
126
|
+
|
|
127
|
+
@staticmethod
|
|
128
|
+
def GetComponentOrigin(request,
|
|
129
|
+
target,
|
|
130
|
+
options=(),
|
|
131
|
+
channel_credentials=None,
|
|
132
|
+
call_credentials=None,
|
|
133
|
+
insecure=False,
|
|
134
|
+
compression=None,
|
|
135
|
+
wait_for_ready=None,
|
|
136
|
+
timeout=None,
|
|
137
|
+
metadata=None):
|
|
138
|
+
return grpc.experimental.unary_unary(request, target, '/scanoss.api.geoprovenance.v2.GeoProvenance/GetComponentOrigin',
|
|
139
|
+
scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.PurlRequest.SerializeToString,
|
|
140
|
+
scanoss_dot_api_dot_geoprovenance_dot_v2_dot_scanoss__geoprovenance__pb2.OriginResponse.FromString,
|
|
141
|
+
options, channel_credentials,
|
|
142
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
scanoss/cli.py
CHANGED
|
@@ -323,8 +323,13 @@ def setup_args() -> None: # noqa: PLR0912, PLR0915
|
|
|
323
323
|
c_provenance = comp_sub.add_parser(
|
|
324
324
|
'provenance',
|
|
325
325
|
aliases=['prov', 'prv'],
|
|
326
|
-
description=f'Show Provenance findings: {__version__}',
|
|
327
|
-
help='Retrieve
|
|
326
|
+
description=f'Show GEO Provenance findings: {__version__}',
|
|
327
|
+
help='Retrieve geoprovenance for the given components',
|
|
328
|
+
)
|
|
329
|
+
c_provenance.add_argument(
|
|
330
|
+
'--origin',
|
|
331
|
+
action='store_true',
|
|
332
|
+
help='Retrieve geoprovenance using contributors origin (default: declared origin)',
|
|
328
333
|
)
|
|
329
334
|
c_provenance.set_defaults(func=comp_provenance)
|
|
330
335
|
|
|
@@ -1579,7 +1584,7 @@ def comp_versions(parser, args):
|
|
|
1579
1584
|
|
|
1580
1585
|
def comp_provenance(parser, args):
|
|
1581
1586
|
"""
|
|
1582
|
-
Run the "component
|
|
1587
|
+
Run the "component provenance" sub-command
|
|
1583
1588
|
Parameters
|
|
1584
1589
|
----------
|
|
1585
1590
|
parser: ArgumentParser
|
|
@@ -1608,7 +1613,7 @@ def comp_provenance(parser, args):
|
|
|
1608
1613
|
timeout=args.timeout,
|
|
1609
1614
|
req_headers=process_req_headers(args.header),
|
|
1610
1615
|
)
|
|
1611
|
-
if not comps.get_provenance_details(args.input, args.purl, args.output):
|
|
1616
|
+
if not comps.get_provenance_details(args.input, args.purl, args.output, args.origin):
|
|
1612
1617
|
sys.exit(1)
|
|
1613
1618
|
|
|
1614
1619
|
|
|
@@ -1711,8 +1716,8 @@ def folder_hashing_scan(parser, args):
|
|
|
1711
1716
|
scanner.best_match = args.best_match
|
|
1712
1717
|
scanner.threshold = args.threshold
|
|
1713
1718
|
|
|
1714
|
-
scanner.scan()
|
|
1715
|
-
|
|
1719
|
+
if scanner.scan():
|
|
1720
|
+
scanner.present(output_file=args.output, output_format=args.format)
|
|
1716
1721
|
except ScanossGrpcError as e:
|
|
1717
1722
|
print_stderr(f'ERROR: {e}')
|
|
1718
1723
|
sys.exit(1)
|
scanoss/components.py
CHANGED
|
@@ -39,7 +39,7 @@ class Components(ScanossBase):
|
|
|
39
39
|
Class for Component functionality
|
|
40
40
|
"""
|
|
41
41
|
|
|
42
|
-
def __init__(
|
|
42
|
+
def __init__( # noqa: PLR0913, PLR0915
|
|
43
43
|
self,
|
|
44
44
|
debug: bool = False,
|
|
45
45
|
trace: bool = False,
|
|
@@ -244,7 +244,7 @@ class Components(ScanossBase):
|
|
|
244
244
|
self._close_file(output_file, file)
|
|
245
245
|
return success
|
|
246
246
|
|
|
247
|
-
def search_components(
|
|
247
|
+
def search_components( # noqa: PLR0913, PLR0915
|
|
248
248
|
self,
|
|
249
249
|
output_file: str = None,
|
|
250
250
|
json_file: str = None,
|
|
@@ -330,14 +330,20 @@ class Components(ScanossBase):
|
|
|
330
330
|
self._close_file(output_file, file)
|
|
331
331
|
return success
|
|
332
332
|
|
|
333
|
-
def get_provenance_details(
|
|
333
|
+
def get_provenance_details(
|
|
334
|
+
self, json_file: str = None, purls: [] = None, output_file: str = None, origin: bool = False
|
|
335
|
+
) -> bool:
|
|
334
336
|
"""
|
|
335
|
-
Retrieve the
|
|
337
|
+
Retrieve the provenance details for the supplied PURLs
|
|
336
338
|
|
|
337
|
-
:
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
339
|
+
Args:
|
|
340
|
+
json_file (str, optional): Input JSON file. Defaults to None.
|
|
341
|
+
purls (None, optional): PURLs to retrieve provenance details for. Defaults to None.
|
|
342
|
+
output_file (str, optional): Output file. Defaults to None.
|
|
343
|
+
origin (bool, optional): Retrieve origin details. Defaults to False.
|
|
344
|
+
|
|
345
|
+
Returns:
|
|
346
|
+
bool: True on success, False otherwise
|
|
341
347
|
"""
|
|
342
348
|
success = False
|
|
343
349
|
purls_request = self.load_purls(json_file, purls)
|
|
@@ -346,12 +352,16 @@ class Components(ScanossBase):
|
|
|
346
352
|
file = self._open_file_or_sdtout(output_file)
|
|
347
353
|
if file is None:
|
|
348
354
|
return False
|
|
349
|
-
|
|
350
|
-
|
|
355
|
+
if origin:
|
|
356
|
+
self.print_msg('Sending PURLs to Geo Provenance Origin API for decoration...')
|
|
357
|
+
response = self.grpc_api.get_provenance_origin(purls_request)
|
|
358
|
+
else:
|
|
359
|
+
self.print_msg('Sending PURLs to Geo Provenance Declared API for decoration...')
|
|
360
|
+
response = self.grpc_api.get_provenance_json(purls_request)
|
|
351
361
|
if response:
|
|
352
362
|
print(json.dumps(response, indent=2, sort_keys=True), file=file)
|
|
353
363
|
success = True
|
|
354
364
|
if output_file:
|
|
355
365
|
self.print_msg(f'Results written to: {output_file}')
|
|
356
366
|
self._close_file(output_file, file)
|
|
357
|
-
return success
|
|
367
|
+
return success
|
scanoss/data/build_date.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
date:
|
|
1
|
+
date: 20250425091203, utime: 1745572323
|
scanoss/scanners/scanner_hfh.py
CHANGED
scanoss/scanossgrpc.py
CHANGED
|
@@ -36,7 +36,6 @@ from google.protobuf.json_format import MessageToDict, ParseDict
|
|
|
36
36
|
from pypac.parser import PACFile
|
|
37
37
|
from pypac.resolver import ProxyResolver
|
|
38
38
|
|
|
39
|
-
from scanoss.api.provenance.v2.scanoss_provenance_pb2_grpc import ProvenanceStub
|
|
40
39
|
from scanoss.api.scanning.v2.scanoss_scanning_pb2_grpc import ScanningStub
|
|
41
40
|
from scanoss.constants import DEFAULT_TIMEOUT
|
|
42
41
|
|
|
@@ -59,7 +58,8 @@ from .api.cryptography.v2.scanoss_cryptography_pb2 import AlgorithmResponse
|
|
|
59
58
|
from .api.cryptography.v2.scanoss_cryptography_pb2_grpc import CryptographyStub
|
|
60
59
|
from .api.dependencies.v2.scanoss_dependencies_pb2 import DependencyRequest
|
|
61
60
|
from .api.dependencies.v2.scanoss_dependencies_pb2_grpc import DependenciesStub
|
|
62
|
-
from .api.
|
|
61
|
+
from .api.geoprovenance.v2.scanoss_geoprovenance_pb2 import ContributorResponse
|
|
62
|
+
from .api.geoprovenance.v2.scanoss_geoprovenance_pb2_grpc import GeoProvenanceStub
|
|
63
63
|
from .api.scanning.v2.scanoss_scanning_pb2 import HFHRequest
|
|
64
64
|
from .api.semgrep.v2.scanoss_semgrep_pb2 import SemgrepResponse
|
|
65
65
|
from .api.semgrep.v2.scanoss_semgrep_pb2_grpc import SemgrepStub
|
|
@@ -169,7 +169,7 @@ class ScanossGrpc(ScanossBase):
|
|
|
169
169
|
self.dependencies_stub = DependenciesStub(grpc.insecure_channel(self.url))
|
|
170
170
|
self.semgrep_stub = SemgrepStub(grpc.insecure_channel(self.url))
|
|
171
171
|
self.vuln_stub = VulnerabilitiesStub(grpc.insecure_channel(self.url))
|
|
172
|
-
self.provenance_stub =
|
|
172
|
+
self.provenance_stub = GeoProvenanceStub(grpc.insecure_channel(self.url))
|
|
173
173
|
self.scanning_stub = ScanningStub(grpc.insecure_channel(self.url))
|
|
174
174
|
else:
|
|
175
175
|
if ca_cert is not None:
|
|
@@ -181,7 +181,7 @@ class ScanossGrpc(ScanossBase):
|
|
|
181
181
|
self.dependencies_stub = DependenciesStub(grpc.secure_channel(self.url, credentials))
|
|
182
182
|
self.semgrep_stub = SemgrepStub(grpc.secure_channel(self.url, credentials))
|
|
183
183
|
self.vuln_stub = VulnerabilitiesStub(grpc.secure_channel(self.url, credentials))
|
|
184
|
-
self.provenance_stub =
|
|
184
|
+
self.provenance_stub = GeoProvenanceStub(grpc.secure_channel(self.url, credentials))
|
|
185
185
|
self.scanning_stub = ScanningStub(grpc.secure_channel(self.url, credentials))
|
|
186
186
|
|
|
187
187
|
@classmethod
|
|
@@ -462,7 +462,7 @@ class ScanossGrpc(ScanossBase):
|
|
|
462
462
|
return resp_dict
|
|
463
463
|
return None
|
|
464
464
|
|
|
465
|
-
def folder_hash_scan(self, request: Dict) -> Dict:
|
|
465
|
+
def folder_hash_scan(self, request: Dict) -> Optional[Dict]:
|
|
466
466
|
"""
|
|
467
467
|
Client function to call the rpc for Folder Hashing Scan
|
|
468
468
|
|
|
@@ -470,7 +470,7 @@ class ScanossGrpc(ScanossBase):
|
|
|
470
470
|
request (Dict): Folder Hash Request
|
|
471
471
|
|
|
472
472
|
Returns:
|
|
473
|
-
Dict: Folder Hash Response
|
|
473
|
+
Optional[Dict]: Folder Hash Response, or None if the request was not succesfull
|
|
474
474
|
"""
|
|
475
475
|
return self._call_rpc(
|
|
476
476
|
self.scanning_stub.FolderHashScan,
|
|
@@ -479,7 +479,7 @@ class ScanossGrpc(ScanossBase):
|
|
|
479
479
|
'Sending folder hash scan data (rqId: {rqId})...',
|
|
480
480
|
)
|
|
481
481
|
|
|
482
|
-
def _call_rpc(self, rpc_method, request_input, request_type, debug_msg: Optional[str] = None) ->
|
|
482
|
+
def _call_rpc(self, rpc_method, request_input, request_type, debug_msg: Optional[str] = None) -> Optional[Dict]:
|
|
483
483
|
"""
|
|
484
484
|
Call a gRPC method and return the response as a dictionary
|
|
485
485
|
|
|
@@ -490,9 +490,8 @@ class ScanossGrpc(ScanossBase):
|
|
|
490
490
|
debug_msg (str, optional): Debug message template that can include {rqId} placeholder.
|
|
491
491
|
|
|
492
492
|
Returns:
|
|
493
|
-
dict: The parsed gRPC response as a dictionary, or None if
|
|
493
|
+
dict: The parsed gRPC response as a dictionary, or None if something went wrong
|
|
494
494
|
"""
|
|
495
|
-
|
|
496
495
|
request_id = str(uuid.uuid4())
|
|
497
496
|
|
|
498
497
|
if isinstance(request_input, dict):
|
|
@@ -503,7 +502,6 @@ class ScanossGrpc(ScanossBase):
|
|
|
503
502
|
metadata = self.metadata[:] + [('x-request-id', request_id)]
|
|
504
503
|
|
|
505
504
|
self.print_debug(debug_msg.format(rqId=request_id))
|
|
506
|
-
|
|
507
505
|
try:
|
|
508
506
|
resp = rpc_method(request_obj, metadata=metadata, timeout=self.timeout)
|
|
509
507
|
except grpc.RpcError as e:
|
|
@@ -512,10 +510,9 @@ class ScanossGrpc(ScanossBase):
|
|
|
512
510
|
)
|
|
513
511
|
|
|
514
512
|
if resp and not self._check_status_response(resp.status, request_id):
|
|
515
|
-
|
|
513
|
+
return None
|
|
516
514
|
|
|
517
515
|
resp_dict = MessageToDict(resp, preserving_proto_field_name=True)
|
|
518
|
-
resp_dict.pop('status', None)
|
|
519
516
|
return resp_dict
|
|
520
517
|
|
|
521
518
|
def _check_status_response(self, status_response: StatusResponse, request_id: str = None) -> bool:
|
|
@@ -574,13 +571,13 @@ class ScanossGrpc(ScanossBase):
|
|
|
574
571
|
self.print_stderr('ERROR: No message supplied to send to gRPC service.')
|
|
575
572
|
return None
|
|
576
573
|
request_id = str(uuid.uuid4())
|
|
577
|
-
resp:
|
|
574
|
+
resp: ContributorResponse
|
|
578
575
|
try:
|
|
579
576
|
request = ParseDict(purls, PurlRequest()) # Parse the JSON/Dict into the purl request object
|
|
580
577
|
metadata = self.metadata[:]
|
|
581
578
|
metadata.append(('x-request-id', request_id)) # Set a Request ID
|
|
582
579
|
self.print_debug(f'Sending data for provenance decoration (rqId: {request_id})...')
|
|
583
|
-
resp = self.provenance_stub.
|
|
580
|
+
resp = self.provenance_stub.GetComponentContributors(request, metadata=metadata, timeout=self.timeout)
|
|
584
581
|
except Exception as e:
|
|
585
582
|
self.print_stderr(
|
|
586
583
|
f'ERROR: {e.__class__.__name__} Problem encountered sending gRPC message (rqId: {request_id}): {e}'
|
|
@@ -593,6 +590,23 @@ class ScanossGrpc(ScanossBase):
|
|
|
593
590
|
return resp_dict
|
|
594
591
|
return None
|
|
595
592
|
|
|
593
|
+
def get_provenance_origin(self, request: Dict) -> Optional[Dict]:
|
|
594
|
+
"""
|
|
595
|
+
Client function to call the rpc for GetComponentOrigin
|
|
596
|
+
|
|
597
|
+
Args:
|
|
598
|
+
request (Dict): GetComponentOrigin Request
|
|
599
|
+
|
|
600
|
+
Returns:
|
|
601
|
+
Optional[Dict]: OriginResponse, or None if the request was not successfull
|
|
602
|
+
"""
|
|
603
|
+
return self._call_rpc(
|
|
604
|
+
self.provenance_stub.GetComponentOrigin,
|
|
605
|
+
request,
|
|
606
|
+
PurlRequest,
|
|
607
|
+
'Sending data for provenance origin decoration (rqId: {rqId})...',
|
|
608
|
+
)
|
|
609
|
+
|
|
596
610
|
def load_generic_headers(self):
|
|
597
611
|
"""
|
|
598
612
|
Adds custom headers from req_headers to metadata.
|
|
@@ -4,9 +4,9 @@ protoc_gen_swagger/options/annotations_pb2.py,sha256=b25EDD6gssUWnFby9gxgcpLIROT
|
|
|
4
4
|
protoc_gen_swagger/options/annotations_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXHDCNMhZD2VXqocC9l_gk,159
|
|
5
5
|
protoc_gen_swagger/options/openapiv2_pb2.py,sha256=vYElGp8E1vGHszvWqX97zNG9GFJ7u2QcdK9ouq0XdyI,14939
|
|
6
6
|
protoc_gen_swagger/options/openapiv2_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXHDCNMhZD2VXqocC9l_gk,159
|
|
7
|
-
scanoss/__init__.py,sha256=
|
|
8
|
-
scanoss/cli.py,sha256=
|
|
9
|
-
scanoss/components.py,sha256=
|
|
7
|
+
scanoss/__init__.py,sha256=CqMRnCqzsM3UDMfg2QSfEduDTsshr2swd5eqsOOvrv4,1146
|
|
8
|
+
scanoss/cli.py,sha256=fdByS-OjSYQbzoZpkT7cez4qkSILpkHPJtRfmSbqDHU,63706
|
|
9
|
+
scanoss/components.py,sha256=b0R9DdKuXqyQiw5nZZwjQ6NJXBr1U9gyx1RI2FP9ozA,14511
|
|
10
10
|
scanoss/constants.py,sha256=9cJxbaXMP4GUIMVn0O1eEyT7Qfq4Jl6BWgZsYQqxQ20,293
|
|
11
11
|
scanoss/csvoutput.py,sha256=qNKRwcChSkgIwLm00kZiVX6iHVQUF4Apl-sMbzJ5Taw,10192
|
|
12
12
|
scanoss/cyclonedx.py,sha256=UktDuqZUbXSggdt864Pg8ziTD7sdEQtLxfYL7vd_ZCE,12756
|
|
@@ -18,7 +18,7 @@ scanoss/scanner.py,sha256=ZL8I8KtVyXgUMcl7Ccbip_Q1IlU9WTgI-mFtSpF1JWw,45223
|
|
|
18
18
|
scanoss/scanoss_settings.py,sha256=393JnWLsEZhvMg5tPUGgxmqnBKp8AcLxYsDRbLP7aV4,10650
|
|
19
19
|
scanoss/scanossapi.py,sha256=v4D9i9Impa82Enw-5hZ7KLlscDIpaILNbGOMj3MJXqs,13067
|
|
20
20
|
scanoss/scanossbase.py,sha256=Dkpwxa8NH8XN1iRl03NM_Mkvby0JQ4qfvCiiUrJ5ul0,3163
|
|
21
|
-
scanoss/scanossgrpc.py,sha256=
|
|
21
|
+
scanoss/scanossgrpc.py,sha256=2SzIEi9tt5REZ6XVR_TrpP2E8wYVZDBKircTIlY8npw,28614
|
|
22
22
|
scanoss/scanpostprocessor.py,sha256=-JsThlxrU70r92GHykTMERnicdd-6jmwNsE4PH0MN2o,11063
|
|
23
23
|
scanoss/scantype.py,sha256=gFmyVmKQpHWogN2iCmMj032e_sZo4T92xS3_EH5B3Tc,1310
|
|
24
24
|
scanoss/spdxlite.py,sha256=MQqFgQhIO-yrbRwEAQS77HmRgP5GDxff-2JYLVoceA0,28946
|
|
@@ -40,10 +40,10 @@ scanoss/api/dependencies/__init__.py,sha256=hx-P78xbDsh6WQIigewkJ7Y7y1fqc_eYnyHC
|
|
|
40
40
|
scanoss/api/dependencies/v2/__init__.py,sha256=hx-P78xbDsh6WQIigewkJ7Y7y1fqc_eYnyHC5IZTKmo,1122
|
|
41
41
|
scanoss/api/dependencies/v2/scanoss_dependencies_pb2.py,sha256=4zG2dIiQnNcicg84WcJPPBqLK5QaOKQjkz49hXRTRkw,6501
|
|
42
42
|
scanoss/api/dependencies/v2/scanoss_dependencies_pb2_grpc.py,sha256=8KjaWuOT5rygIMe2oWTmyZND3Ugt7K3g94K7a1Mbwcs,6875
|
|
43
|
-
scanoss/api/
|
|
44
|
-
scanoss/api/
|
|
45
|
-
scanoss/api/
|
|
46
|
-
scanoss/api/
|
|
43
|
+
scanoss/api/geoprovenance/__init__.py,sha256=KlDD87JmyZP-10T-fuJo0_v2zt1gxWfTgs70wjky9xg,1139
|
|
44
|
+
scanoss/api/geoprovenance/v2/__init__.py,sha256=KlDD87JmyZP-10T-fuJo0_v2zt1gxWfTgs70wjky9xg,1139
|
|
45
|
+
scanoss/api/geoprovenance/v2/scanoss_geoprovenance_pb2.py,sha256=Z4k9qvU2klesnPRW9DRV6Lq79GT2XJSxYHKpSm3s1HA,5403
|
|
46
|
+
scanoss/api/geoprovenance/v2/scanoss_geoprovenance_pb2_grpc.py,sha256=B6sv2Taagt05CMWaw7T6silg7PW8E6xQVbqn_4-v14U,6854
|
|
47
47
|
scanoss/api/scanning/__init__.py,sha256=hx-P78xbDsh6WQIigewkJ7Y7y1fqc_eYnyHC5IZTKmo,1122
|
|
48
48
|
scanoss/api/scanning/v2/__init__.py,sha256=hx-P78xbDsh6WQIigewkJ7Y7y1fqc_eYnyHC5IZTKmo,1122
|
|
49
49
|
scanoss/api/scanning/v2/scanoss_scanning_pb2.py,sha256=rHScTNN5_jsgLu_y3UIPTjeBX74GUw0kyjA-IMoz7mQ,4324
|
|
@@ -56,7 +56,7 @@ scanoss/api/vulnerabilities/__init__.py,sha256=IFrDk_DTJgKSZmmU-nuLXuq_s8sQZlrSC
|
|
|
56
56
|
scanoss/api/vulnerabilities/v2/__init__.py,sha256=IFrDk_DTJgKSZmmU-nuLXuq_s8sQZlrSCHhIDMJT4r0,1122
|
|
57
57
|
scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2.py,sha256=CFhF80av8tenGvn9AIsGEtRJPuV2dC_syA5JLZb2lDw,5464
|
|
58
58
|
scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2_grpc.py,sha256=HlS4k4Zmx6RIAqaO9I96jD-eyF5yU6Xx04pVm7pdqOg,6864
|
|
59
|
-
scanoss/data/build_date.txt,sha256=
|
|
59
|
+
scanoss/data/build_date.txt,sha256=G5TAnGlLvFVpqBLQYKD1FtFr0kpQDLVD8zI69TRvA90,40
|
|
60
60
|
scanoss/data/scanoss-settings-schema.json,sha256=ClkRYAkjAN0Sk704G8BE_Ok006oQ6YnIGmX84CF8h9w,8798
|
|
61
61
|
scanoss/data/spdx-exceptions.json,sha256=s7UTYxC7jqQXr11YBlIWYCNwN6lRDFTR33Y8rpN_dA4,17953
|
|
62
62
|
scanoss/data/spdx-licenses.json,sha256=A6Z0q82gaTLtnopBfzeIVZjJFxkdRW1g2TuumQc-lII,228794
|
|
@@ -69,15 +69,15 @@ scanoss/scanners/__init__.py,sha256=D4C0lWLuNp8k_BjQZEc07WZcUgAvriVwQWOk063b0ZU,
|
|
|
69
69
|
scanoss/scanners/container_scanner.py,sha256=leP4roes6B9B95F49mJ0P_F8WcKCQkvJgk9azWyJrjg,16294
|
|
70
70
|
scanoss/scanners/folder_hasher.py,sha256=ePWinOTN3neSVz7T81TAF7GZVAGNYGJ8SfhM5LBYWb8,9824
|
|
71
71
|
scanoss/scanners/scanner_config.py,sha256=egG7cw3S2akU-D9M1aLE5jLrfz_c8e7_DIotMnnpM84,2601
|
|
72
|
-
scanoss/scanners/scanner_hfh.py,sha256=
|
|
72
|
+
scanoss/scanners/scanner_hfh.py,sha256=KksrC1XnOv7mXSlGyo_AJXwtPfKjqffkttdPoNDc-AQ,5802
|
|
73
73
|
scanoss/utils/__init__.py,sha256=0hjb5ktavp7utJzFhGMPImPaZiHWgilM2HwvTp5lXJE,1122
|
|
74
74
|
scanoss/utils/abstract_presenter.py,sha256=teiDTxBj5jBMCk2T8i4l1BJPf_u4zBLWrtCTFHSSECM,3148
|
|
75
75
|
scanoss/utils/crc64.py,sha256=TMrwQimSdE6imhFOUL7oAG6Kxu-8qMpGWMuMg8QpSVs,3169
|
|
76
76
|
scanoss/utils/file.py,sha256=yVyv7C7xLWtFNfUrv3r6W8tkIqEuPjZ7_mgIT01IjJs,2933
|
|
77
77
|
scanoss/utils/simhash.py,sha256=6iu8DOcecPAY36SZjCOzrrLMT9oIE7-gI6QuYwUQ7B0,5793
|
|
78
|
-
scanoss-1.
|
|
79
|
-
scanoss-1.
|
|
80
|
-
scanoss-1.
|
|
81
|
-
scanoss-1.
|
|
82
|
-
scanoss-1.
|
|
83
|
-
scanoss-1.
|
|
78
|
+
scanoss-1.23.0.dist-info/licenses/LICENSE,sha256=LLUaXoiyOroIbr5ubAyrxBOwSRLTm35ETO2FmLpy8QQ,1074
|
|
79
|
+
scanoss-1.23.0.dist-info/METADATA,sha256=pdGRVPWFrt8Xw86e3X3IXd1_n7mrbyTmGY340ybaCRw,6060
|
|
80
|
+
scanoss-1.23.0.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
|
81
|
+
scanoss-1.23.0.dist-info/entry_points.txt,sha256=Uy28xnaDL5KQ7V77sZD5VLDXPNxYYzSr5tsqtiXVzAs,48
|
|
82
|
+
scanoss-1.23.0.dist-info/top_level.txt,sha256=V11PrQ6Pnrc-nDF9xnisnJ8e6-i7HqSIKVNqduRWcL8,27
|
|
83
|
+
scanoss-1.23.0.dist-info/RECORD,,
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
-
# source: scanoss/api/provenance/v2/scanoss-provenance.proto
|
|
4
|
-
"""Generated protocol buffer code."""
|
|
5
|
-
from google.protobuf.internal import builder as _builder
|
|
6
|
-
from google.protobuf import descriptor as _descriptor
|
|
7
|
-
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
8
|
-
from google.protobuf import symbol_database as _symbol_database
|
|
9
|
-
# @@protoc_insertion_point(imports)
|
|
10
|
-
|
|
11
|
-
_sym_db = _symbol_database.Default()
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
from scanoss.api.common.v2 import scanoss_common_pb2 as scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2
|
|
15
|
-
from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
|
|
16
|
-
from protoc_gen_swagger.options import annotations_pb2 as protoc__gen__swagger_dot_options_dot_annotations__pb2
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n2scanoss/api/provenance/v2/scanoss-provenance.proto\x12\x19scanoss.api.provenance.v2\x1a*scanoss/api/common/v2/scanoss-common.proto\x1a\x1cgoogle/api/annotations.proto\x1a,protoc-gen-swagger/options/annotations.proto\"\xd5\x03\n\x12ProvenanceResponse\x12\x42\n\x05purls\x18\x01 \x03(\x0b\x32\x33.scanoss.api.provenance.v2.ProvenanceResponse.Purls\x12\x35\n\x06status\x18\x02 \x01(\x0b\x32%.scanoss.api.common.v2.StatusResponse\x1a\x32\n\x10\x44\x65\x63laredLocation\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x10\n\x08location\x18\x02 \x01(\t\x1a\x31\n\x0f\x43uratedLocation\x12\x0f\n\x07\x63ountry\x18\x01 \x01(\t\x12\r\n\x05\x63ount\x18\x02 \x01(\x05\x1a\xdc\x01\n\x05Purls\x12\x0c\n\x04purl\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\t\x12Z\n\x12\x64\x65\x63lared_locations\x18\x03 \x03(\x0b\x32>.scanoss.api.provenance.v2.ProvenanceResponse.DeclaredLocation\x12X\n\x11\x63urated_locations\x18\x04 \x03(\x0b\x32=.scanoss.api.provenance.v2.ProvenanceResponse.CuratedLocation2\x98\x02\n\nProvenance\x12s\n\x04\x45\x63ho\x12\".scanoss.api.common.v2.EchoRequest\x1a#.scanoss.api.common.v2.EchoResponse\"\"\x82\xd3\xe4\x93\x02\x1c\"\x17/api/v2/provenance/echo:\x01*\x12\x94\x01\n\x16GetComponentProvenance\x12\".scanoss.api.common.v2.PurlRequest\x1a-.scanoss.api.provenance.v2.ProvenanceResponse\"\'\x82\xd3\xe4\x93\x02!\"\x1c/api/v2/provenance/countries:\x01*B\x94\x02Z5github.com/scanoss/papi/api/provenancev2;provenancev2\x92\x41\xd9\x01\x12s\n\x1aSCANOSS Provenance Service\"P\n\x12scanoss-provenance\x12%https://github.com/scanoss/provenance\x1a\x13support@scanoss.com2\x03\x32.0*\x01\x01\x32\x10\x61pplication/json:\x10\x61pplication/jsonR;\n\x03\x34\x30\x34\x12\x34\n*Returned when the resource does not exist.\x12\x06\n\x04\x9a\x02\x01\x07\x62\x06proto3')
|
|
20
|
-
|
|
21
|
-
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
|
|
22
|
-
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'scanoss.api.provenance.v2.scanoss_provenance_pb2', globals())
|
|
23
|
-
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
24
|
-
|
|
25
|
-
DESCRIPTOR._options = None
|
|
26
|
-
DESCRIPTOR._serialized_options = b'Z5github.com/scanoss/papi/api/provenancev2;provenancev2\222A\331\001\022s\n\032SCANOSS Provenance Service\"P\n\022scanoss-provenance\022%https://github.com/scanoss/provenance\032\023support@scanoss.com2\0032.0*\001\0012\020application/json:\020application/jsonR;\n\003404\0224\n*Returned when the resource does not exist.\022\006\n\004\232\002\001\007'
|
|
27
|
-
_PROVENANCE.methods_by_name['Echo']._options = None
|
|
28
|
-
_PROVENANCE.methods_by_name['Echo']._serialized_options = b'\202\323\344\223\002\034\"\027/api/v2/provenance/echo:\001*'
|
|
29
|
-
_PROVENANCE.methods_by_name['GetComponentProvenance']._options = None
|
|
30
|
-
_PROVENANCE.methods_by_name['GetComponentProvenance']._serialized_options = b'\202\323\344\223\002!\"\034/api/v2/provenance/countries:\001*'
|
|
31
|
-
_PROVENANCERESPONSE._serialized_start=202
|
|
32
|
-
_PROVENANCERESPONSE._serialized_end=671
|
|
33
|
-
_PROVENANCERESPONSE_DECLAREDLOCATION._serialized_start=347
|
|
34
|
-
_PROVENANCERESPONSE_DECLAREDLOCATION._serialized_end=397
|
|
35
|
-
_PROVENANCERESPONSE_CURATEDLOCATION._serialized_start=399
|
|
36
|
-
_PROVENANCERESPONSE_CURATEDLOCATION._serialized_end=448
|
|
37
|
-
_PROVENANCERESPONSE_PURLS._serialized_start=451
|
|
38
|
-
_PROVENANCERESPONSE_PURLS._serialized_end=671
|
|
39
|
-
_PROVENANCE._serialized_start=674
|
|
40
|
-
_PROVENANCE._serialized_end=954
|
|
41
|
-
# @@protoc_insertion_point(module_scope)
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
-
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
-
import grpc
|
|
4
|
-
|
|
5
|
-
from scanoss.api.common.v2 import scanoss_common_pb2 as scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2
|
|
6
|
-
from scanoss.api.provenance.v2 import scanoss_provenance_pb2 as scanoss_dot_api_dot_provenance_dot_v2_dot_scanoss__provenance__pb2
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class ProvenanceStub(object):
|
|
10
|
-
"""*
|
|
11
|
-
Expose all of the SCANOSS Provenance RPCs here
|
|
12
|
-
"""
|
|
13
|
-
|
|
14
|
-
def __init__(self, channel):
|
|
15
|
-
"""Constructor.
|
|
16
|
-
|
|
17
|
-
Args:
|
|
18
|
-
channel: A grpc.Channel.
|
|
19
|
-
"""
|
|
20
|
-
self.Echo = channel.unary_unary(
|
|
21
|
-
'/scanoss.api.provenance.v2.Provenance/Echo',
|
|
22
|
-
request_serializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.EchoRequest.SerializeToString,
|
|
23
|
-
response_deserializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.EchoResponse.FromString,
|
|
24
|
-
)
|
|
25
|
-
self.GetComponentProvenance = channel.unary_unary(
|
|
26
|
-
'/scanoss.api.provenance.v2.Provenance/GetComponentProvenance',
|
|
27
|
-
request_serializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.PurlRequest.SerializeToString,
|
|
28
|
-
response_deserializer=scanoss_dot_api_dot_provenance_dot_v2_dot_scanoss__provenance__pb2.ProvenanceResponse.FromString,
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
class ProvenanceServicer(object):
|
|
33
|
-
"""*
|
|
34
|
-
Expose all of the SCANOSS Provenance RPCs here
|
|
35
|
-
"""
|
|
36
|
-
|
|
37
|
-
def Echo(self, request, context):
|
|
38
|
-
"""Standard echo
|
|
39
|
-
"""
|
|
40
|
-
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
41
|
-
context.set_details('Method not implemented!')
|
|
42
|
-
raise NotImplementedError('Method not implemented!')
|
|
43
|
-
|
|
44
|
-
def GetComponentProvenance(self, request, context):
|
|
45
|
-
"""Get Provenance countries associated with a list of PURLs
|
|
46
|
-
"""
|
|
47
|
-
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
48
|
-
context.set_details('Method not implemented!')
|
|
49
|
-
raise NotImplementedError('Method not implemented!')
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
def add_ProvenanceServicer_to_server(servicer, server):
|
|
53
|
-
rpc_method_handlers = {
|
|
54
|
-
'Echo': grpc.unary_unary_rpc_method_handler(
|
|
55
|
-
servicer.Echo,
|
|
56
|
-
request_deserializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.EchoRequest.FromString,
|
|
57
|
-
response_serializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.EchoResponse.SerializeToString,
|
|
58
|
-
),
|
|
59
|
-
'GetComponentProvenance': grpc.unary_unary_rpc_method_handler(
|
|
60
|
-
servicer.GetComponentProvenance,
|
|
61
|
-
request_deserializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.PurlRequest.FromString,
|
|
62
|
-
response_serializer=scanoss_dot_api_dot_provenance_dot_v2_dot_scanoss__provenance__pb2.ProvenanceResponse.SerializeToString,
|
|
63
|
-
),
|
|
64
|
-
}
|
|
65
|
-
generic_handler = grpc.method_handlers_generic_handler(
|
|
66
|
-
'scanoss.api.provenance.v2.Provenance', rpc_method_handlers)
|
|
67
|
-
server.add_generic_rpc_handlers((generic_handler,))
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
# This class is part of an EXPERIMENTAL API.
|
|
71
|
-
class Provenance(object):
|
|
72
|
-
"""*
|
|
73
|
-
Expose all of the SCANOSS Provenance RPCs here
|
|
74
|
-
"""
|
|
75
|
-
|
|
76
|
-
@staticmethod
|
|
77
|
-
def Echo(request,
|
|
78
|
-
target,
|
|
79
|
-
options=(),
|
|
80
|
-
channel_credentials=None,
|
|
81
|
-
call_credentials=None,
|
|
82
|
-
insecure=False,
|
|
83
|
-
compression=None,
|
|
84
|
-
wait_for_ready=None,
|
|
85
|
-
timeout=None,
|
|
86
|
-
metadata=None):
|
|
87
|
-
return grpc.experimental.unary_unary(request, target, '/scanoss.api.provenance.v2.Provenance/Echo',
|
|
88
|
-
scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.EchoRequest.SerializeToString,
|
|
89
|
-
scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.EchoResponse.FromString,
|
|
90
|
-
options, channel_credentials,
|
|
91
|
-
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
92
|
-
|
|
93
|
-
@staticmethod
|
|
94
|
-
def GetComponentProvenance(request,
|
|
95
|
-
target,
|
|
96
|
-
options=(),
|
|
97
|
-
channel_credentials=None,
|
|
98
|
-
call_credentials=None,
|
|
99
|
-
insecure=False,
|
|
100
|
-
compression=None,
|
|
101
|
-
wait_for_ready=None,
|
|
102
|
-
timeout=None,
|
|
103
|
-
metadata=None):
|
|
104
|
-
return grpc.experimental.unary_unary(request, target, '/scanoss.api.provenance.v2.Provenance/GetComponentProvenance',
|
|
105
|
-
scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.PurlRequest.SerializeToString,
|
|
106
|
-
scanoss_dot_api_dot_provenance_dot_v2_dot_scanoss__provenance__pb2.ProvenanceResponse.FromString,
|
|
107
|
-
options, channel_credentials,
|
|
108
|
-
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|