Please add support for the '/api/5.0/beginprescan.do' xml api
Closed this issue · 3 comments
brunzefb commented
Please add support for the '/api/5.0/beginprescan.do'
brunzefb commented
implementation can be sort of like this:
def begin_pre_scan(app_id):
# the library does not support this call, we roll our own
print('Initiating scan...')
endpoint = 'https://analysiscenter.veracode.com/api/5.0/beginprescan.do'
try:
response = requests.post(endpoint,
params={'app_id': app_id, 'auto_scan': 'true'},
auth=RequestsAuthPluginVeracodeHMAC(),
headers=HEADERS)
except requests.RequestException as e:
print("Call to " + endpoint + " failed.")
print(EXCEPTION_DETAILS_FOLLOW)
print(e)
sys.exit(1)
if response.ok:
if 'has been updated by another transaction' in response.text:
print('Another scan is likely in progress for ' + app_id + '. Please try again later.')
sys.exit(1)
root = element_tree.fromstring(response.text)
return root.attrib['build_id']
print("Call to " + endpoint + " failed.")
sys.exit(1)
brunzefb commented
Very nice! By the way I was able to integrate 0.9.31, the upload_file() api makes my code way nicer:
def upload_file(app_id, file_name):
print('Uploading file to Veracode: ' + file_name + '...')
api = veracode_api_py.VeracodeAPI()
try:
api.upload_file(app_id, file_name)
except veracode_api_py.VeracodeAPIError as e:
print(EXCEPTION_DETAILS_FOLLOW)
print(e)
sys.exit(1)
tjarrettveracode commented
Great! Glad that this improvement helped.