qbraid.runtime.ionq.IonQSession
- class IonQSession(api_key=None)[source]
IonQ session class.
Initialize custom session with default base_url and auth_headers.
- Parameters:
base_url (optional, str) – Base URL to prepend to all requests.
headers (optional, dict) – Dictionary of headers to include in all requests.
auth_headers (optional, dict) – Dictionary of authorization headers to include in all requests. Values will be masked in error messages.
- __init__(api_key=None)[source]
Initialize custom session with default base_url and auth_headers.
- Parameters:
base_url (optional, str) – Base URL to prepend to all requests.
headers (optional, dict) – Dictionary of headers to include in all requests.
auth_headers (optional, dict) – Dictionary of authorization headers to include in all requests. Values will be masked in error messages.
Methods
__init__
([api_key])Initialize custom session with default base_url and auth_headers.
add_user_agent
(user_agent)Updates the User-Agent header with additional information.
cancel_job
(job_id)Cancel a specific IonQ job.
close
()Closes all adapters and as such the session
create_job
(data)Create a new job on the IonQ API.
delete
(url, **kwargs)Sends a DELETE request.
get
(url, **kwargs)Sends a GET request.
get_adapter
(url)Returns the appropriate connection adapter for the given URL.
get_device
(device_id)Get a specific IonQ device.
get_devices
(**kwargs)Get all IonQ devices.
get_job
(job_id)Get a specific IonQ job.
get_redirect_target
(resp)Receives a Response.
head
(url, **kwargs)Sends a HEAD request.
initialize_retry
([total, connect, ...])Set the session retry policy.
merge_environment_settings
(url, proxies, ...)Check the environment and merge it with some settings.
mount
(prefix, adapter)Registers a connection adapter to a prefix.
options
(url, **kwargs)Sends a OPTIONS request.
patch
(url[, data])Sends a PATCH request.
post
(url[, data, json])Sends a POST request.
prepare_request
(request)Constructs a
PreparedRequest
for transmission and returns it.put
(url[, data])Sends a PUT request.
rebuild_auth
(prepared_request, response)When being redirected we may want to strip authentication from the request to avoid leaking credentials.
rebuild_method
(prepared_request, response)When being redirected we may want to change the method of the request based on certain specs or browser behavior.
rebuild_proxies
(prepared_request, proxies)This method re-evaluates the proxy configuration by considering the environment variables.
request
(method, url, *args, **kwargs)Construct, prepare, and send a
Request
.resolve_redirects
(resp, req[, stream, ...])Receives a Response.
send
(request, **kwargs)Send a given PreparedRequest.
should_strip_auth
(old_url, new_url)Decide whether Authorization header should be removed when redirecting
Attributes
base_url
Return the base URL.
headers
A case-insensitive dictionary of headers to be sent on each
Request
sent from thisSession
.auth
Default Authentication tuple or object to attach to
Request
.proxies
Dictionary mapping protocol or protocol and host to the URL of the proxy (e.g. {'http': 'foo.bar:3128', 'http://host.name': 'foo.bar:4012'}) to be used on each
Request
.hooks
Event-handling hooks.
params
Dictionary of querystring data to attach to each
Request
.stream
Stream response content default.
verify
SSL Verification default.
cert
SSL client certificate default, if String, path to ssl client cert file (.pem).
max_redirects
Maximum number of redirects allowed.
trust_env
Trust environment settings for proxy configuration, default authentication and similar.
cookies
A CookieJar containing all currently outstanding cookies set on this session.