for project in bd.get_resource('projects'):
m = get_metadata('versions', project)
print("Num versions: " + m['totalCount'])
is a shortcut for:
for project in bd.get_resource('projects'):
m = get_resource('versions', project, items=False, params={'limit': 1})
print("Num versions: " + m['totalCount'])
Error1: Without bd, get_metadata error found
Traceback (most recent call last):
File "get_resource.py", line 43, in <module>
m = get_metadata('versions', project)
NameError: name 'get_metadata' is not defined
Error2: Another error is that can not concatenate str to int
Traceback (most recent call last):
File "get_resource.py", line 44, in <module>
print("Num versions: " + m['totalCount'])
TypeError: can only concatenate str (not "int") to str
The above code could be modified as follows: (tested and run without error)
for project in bd.get_resource('projects'):
m = bd.get_metadata('versions', project)
print(f"Num versions: {m['totalCount']}")
is a shortcut for:
for project in bd.get_resource('projects'):
m = bd.get_resource('versions', project, items=False, params={'limit': 1})
print(f"Num versions: {m['totalCount']}")
The example of get_metadata in the wiki has two errors
Here is the link: https://github.com/blackducksoftware/hub-rest-api-python/wiki/Client-API-Reference#get_resource
Example
is a shortcut for:
Error1: Without
bd
,get_metadata
error foundError2: Another error is that can not concatenate str to int
The above code could be modified as follows: (tested and run without error)
is a shortcut for: