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
Added the rest_api_url argument to the constructor of the SnykClient class.
Used this argument to initialize the REST_API_URL variable if a value is provided, otherwise the default value is used.
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
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 theSnykClient
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 theSnykClient
object. This flexibility will allow users to choose the REST API URL that best suits their needs.Technical Details
rest_api_url
argument to the constructor of theSnykClient
class.REST_API_URL
variable if a value is provided, otherwise the default value is used.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 forrest_api_url
and verify that the customized URL is used for REST API requests.Example Usage