Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

please add support for the 'api/4.0/detailedreportpdf.do' api #39

Open
brunzefb opened this issue Nov 5, 2022 · 1 comment
Open

please add support for the 'api/4.0/detailedreportpdf.do' api #39

brunzefb opened this issue Nov 5, 2022 · 1 comment

Comments

@brunzefb
Copy link

brunzefb commented Nov 5, 2022

please add support for the 'api/4.0/detailedreportpdf.do' api

@brunzefb
Copy link
Author

brunzefb commented Nov 5, 2022

implementation can be sort of like this:

def download_report(build_id, file_to_be_uploaded):
    print('Downloading the pdf report')
    name = os.path.splitext(file_to_be_uploaded)[0]
    endpoint = 'https://analysiscenter.veracode.com/api/4.0/detailedreportpdf.do'
    try:
        response = requests.get(endpoint,
                                allow_redirects=True,
                                params={'build_id': build_id},
                                auth=RequestsAuthPluginVeracodeHMAC(),
                                headers=HEADERS)
    except requests.RequestException as e:
        print(EXCEPTION_DETAILS_FOLLOW)
        print(e)
        sys.exit(1)

    if response.ok:
        file_name = get_filename_from_content_disposition(response.headers.get('content-disposition'))
        if not file_name:
            file_name = name
        file_name = name + '-' + file_name
        open(file_name, 'wb').write(response.content)
        print("Success! Report filename: " + file_name)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant