snyk-labs / pysnyk

A Python client for the Snyk API.
https://snyk.docs.apiary.io/
MIT License
85 stars 116 forks source link

Enhancement: Make REST_API_URL Customizable in SnykClient Constructor #206

Closed clem-decath closed 8 months ago

clem-decath commented 10 months ago

Modification of REST_API_URL to be customizable

Description of Changes

In this modification, I have made the REST_API_URL variable customizable when creating an instance of the SnykClient class. Previously, this URL was statically defined within the class, but now users can specify a different URL for the REST API by passing the desired value as an argument when creating the SnykClient object. This flexibility will allow users to choose the REST API URL that best suits their needs.

Technical Details

Context

This modification was made to enable users to customize the REST API URL when using the pysnyk library. It provides more flexibility for developers who want to interact with different instances of the Snyk API.

How to Test

This modification does not impact the existing functionality of the library. You can still create an instance of the SnykClient class by passing a different value for rest_api_url and verify that the customized URL is used for REST API requests.

Example Usage


client = SnykClient(token=api_key, url="https://app.eu.snyk.io/api/", rest_api_url="https://api.eu.snyk.io/rest")

# Now, the client will use the customized URL for the REST API