Skip to main content

fossology API wrapper in python 3.10

Project description

easy_fossy

Snake fonts For Font credit Refer <1>

Accessing fossy api is made easier (requires python 3.10)

Production Index Registry

Test Index Registry

pip install easy-fossy

Requires

#### 1. python 3.9

(uses latest structural matching case patterms)

#### 2. pip install easy-fossy

#### 3. configure your server in config.ini

(config.ini file with below contents is essential & effortless kickstart)

[test]
url = http://fossology-test.com:port/repo/api/v1/
uname =
pwd =
access = write
bearer_token = Bearer OHNSUFaI6OtoFNz
token_valdity_days = 365
token_expire = 2022-10-29
reports_location = reports/
group_name = fossy

[prod]
url = http://fossology.com:port/repo/api/v1/
uname =
pwd =
access = write
bearer_token = Bearer OHNSUFaI6OtoFNz
token_valdity_days = 365
token_expire = 2022-10-29
reports_location = reports/
group_name = fossy
#### 4.  Kickstart straight away with example.py

example.py

Useful functions to import and try

    from easy_fossy import easy_fossy as fossy


To set the location of config.ini file and get the instance to access all the methods use below code


    use_fossy_to=fossy('location/config.ini','test')


    use_fossy_to=fossy('location/config.ini','prod',verify=True)


1. use_fossy_to.delete_uploads_by_upload_id(upload_id=7)

2. use_fossy_to.trigger_analysis_for_git_upload_package(
    git_url='https://github.com/dineshr93/pageres', branch_name='master', folder_id=1)
Avoids duplicate uploads

3. use_fossy_to.trigger_analysis_for_url_upload_package(
    file_download_url='https://github.com/dineshr93/pageres/archive/refs/heads/master.zip',
    file_name='pageres.zip', branch_name='', folder_id=1)
Avoids duplicate uploads

4. use_fossy_to.trigger_analysis_for_upload_package(
    file_path='uploads/commons-lang3-3.12.0-src.zip', folder_id=1)
Avoids duplicate uploads

5. use_fossy_to.trigger_analysis_for_upload_id(
    upload_id=4, folder_id=1)

6. use_fossy_to.get_upload_id_by_giturl_package_upload(git_url='https://github.com/dineshr93/pageres',
                                        branch_name='master', upload_name='',
                                       folder_id=1, upload_desc='', visibility=Public.public)

7. use_fossy_to.get_upload_id_by_download_url_package_upload(
    file_download_url='https://github.com/dineshr93/pageres/archive/refs/heads/master.zip',
    file_name='pageres', folder_id=1, upload_desc='commons-io-2.11.0', visibility=Public.public)


8. use_fossy_to.get_upload_id_by_local_package_upload(
    file_path='uploads/commons-io-2.11.0-src.zip', folder_id=1, upload_desc='commons-io-2.11.0',
    visibility=Public.public)

9. use_fossy_to.get_licenses_found_by_agents_for_uploadid
        (upload_id=2, show_directories=True, agents=[
                Agent.ninka.name, Agent.monk.name, Agent.nomos.name, Agent.ojo.name,
                Agent.reportImport.name,
                Agent.reso.name])


10. use_fossy_to.get_all_uploads_based_on(folder_id=1, is_recursive=True,
                         search_pattern_key='', upload_status=ClearingStatus.Open,
                         assignee='', since_yyyy_mm_dd='', page=1, limit=1000)


11. use_fossy_to.get_upload_summary_for_uploadid(upload_id=2)


12. use_fossy_to.apply_action_to_folderid(actions=Action.move, folder_id=6, parent_folder_id=2)

13. use_fossy_to.delete_folder_by_id(folder_id=3)

14. use_fossy_to.get_all_folders()


15. use_fossy_to.create_folder_under_parent_folder_id(
    parent_folder_id=1, folder_name='test')

16. use_fossy_to.change_folder_name_or_desc(folder_id=3, new_folder_name='', new_folder_desc='')

17. use_fossy_to.get_folder_info_by_id(folder_id=11)

18. use_fossy_to.get_all_folders()

19. use_fossy_to.generate_and_get_desired_report_for_uploadid(upload_id=3, report_format=ReportFormat.unifiedreport)

20. use_fossy_to.get_job_info_by_id(job_id=3)


21. use_fossy_to.get_job_info_by_upload_id(job_id=3)

22. use_fossy_to.get_all_jobs()

From 1.0.6
23. use_fossy_to.get_all_license_based_on(is_active='true', license_kind=Kind.main, page=1, limit=1)

24. sns = use_fossy_to.get_all_license_short_names_based_on(
        is_active='true', license_kind=Kind.main, contains_key='gp', page=1, limit=10000)
    for i, sn in enumerate(sns, start=1):
        print(f'{i}. {sn}')

From 1.0.9
25. use_fossy_to.get_license_by_short_name(short_name='AGPL-1.0')

26. use_fossy_to.add_new_license(unique_short_name='', new_full_name='', new_license_text='',
                new_url='', new_risk=2, isCandidate=True, merge_request=False)

27. use_fossy_to.update_license_info_by_short_name(short_name='', new_full_name='', new_license_text='', new_url='', new_risk=2)

28. use_fossy_to.search_files_based_on(self, filename_wildcard: str, searchType: SearchType, uploadId: int, tag: str, filesizemin_bytes: int, filesizemax_bytes: int, license: str, copyright: str) -> List[SearchResults] | Info:
--- give SearchType.Directory and filename_wildcard = 'draw%' (for draPaintIO.zip)

29 use_fossy_to.get_file_by_any_one_of_sha1_or_md5_or_sha256(self, sha1: str = '', md5: str = '', sha256: str = '') -> str | List[File]:
--- give only one hash of any of 3 format sha1 or sha256 or md5
--- returns list if even only data is there else it will return 'not found' string.

30  get_all_users()

31  get_user_by_id(user_id=)
twine upload --repository pypi dist/* --config-file .pypirc

=====================================================================

License: MIT

MIT License

Copyright (c) 2021 Dinesh Ravi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

<1> Font by Tehisa by Sealoung https://www.fontspace.com/category/snake License: Personal Use Free

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easy_fossy-2.4.13.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easy_fossy-2.4.13-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file easy_fossy-2.4.13.tar.gz.

File metadata

  • Download URL: easy_fossy-2.4.13.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.0

File hashes

Hashes for easy_fossy-2.4.13.tar.gz
Algorithm Hash digest
SHA256 5ba4868bd03c41e6449015d796d681793aa73519a99941bd3e88ef0c6ed104bf
MD5 819791b7777309913410bc57bf315ac4
BLAKE2b-256 0bbd89bc59779af2c46eb44ba7efb7377875d0e90484eb2da9c1c650242ed679

See more details on using hashes here.

File details

Details for the file easy_fossy-2.4.13-py3-none-any.whl.

File metadata

  • Download URL: easy_fossy-2.4.13-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.0

File hashes

Hashes for easy_fossy-2.4.13-py3-none-any.whl
Algorithm Hash digest
SHA256 a2a364a528e52ad3921d25dcc26ddcdac1fe5fdd7e10833ea77703f7005badd1
MD5 0468d1aeb640cd4cfdcd614a0f3b5ae6
BLAKE2b-256 831aae8e767b09124f9b3f36bb719634b89ce77d4a94e44e020691924ef1f3ca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page