-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add custom url resolver to enable using other endpoints (#1914)
* custom url resolver * deprecate get_runtime_api_base_url
- Loading branch information
1 parent
7e79b7c
commit 0754905
Showing
7 changed files
with
69 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Deprecate util function `get_runtime_api_base_url`: use `default_runtime_url_resolver` instead. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Add `url_resolver` optional input to :class:`.QiskitRuntimeService` | ||
constructor to enable custom generation of the Qiskit Runtime API URL | ||
based on the provided `url`, `instance` and `private_endpoint`. If | ||
not specified, the default resolver will be used. | ||
|
||
.. code:: python | ||
# Define a custom resolver. In this case returns the concatenation of the provided `url` and the `instance` | ||
def custom_url_resolver(url, instance, *args, **kwargs): | ||
return f"{url}/{instance}" | ||
service = QiskitRuntimeService(channel="ibm_quantum", instance="ibm-q/open/main", url="https://baseurl.org" url_resolver=custom_url_resolver) | ||
# resulting resolved url will be: `https://baseurl.org/ibm-q/open/main` | ||
Add util function `default_runtime_url_resolver`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters