このコンテンツは選択した言語では利用できません。

Chapter 16. Using the Software Development Kit


16.1. Connecting to the API Using Python

To connect to the REST API using Python, you must create an instance of the API class from the ovirtsdk.api module. To be able to do this, it is necessary to first import the class at the start of the script:
from ovirtsdk.api import API
Copy to Clipboard Toggle word wrap
The constuctor of the API class takes a number of arguments. Supported arguments are:
url
Specifies the URL of the Manager to connect to, including the /api path. This parameter is mandatory.
username
Specifies the user name to use when connecting, in the User Principle Name (UPN) format. This parameter is mandatory.
password
Specifies the password for the user provided by the username parameter. This parameter is mandatory.
key_file
Specifies a PEM-formatted key file containing the private key associated with the certificate specified by cert_file. This parameter is optional.
cert_file
Specifies a PEM-formatted client certificate to be used for establishing the identity of the client on the server. This parameter is optional.
ca_file
Specifies the certificate file of the certificate authority for the server. This parameter is mandatory unless the insecure parameter is set to True.
port
Specifies the port to use when connecting, where it has not been provided as component of the url parameter. This parameter is optional.
timeout
Specifies the amount of time in seconds that is allowed to pass before a request is considered to be timed out. This parameter is optional.
persistent_auth
Specifies whether persistent authentication is enabled for this connection. Valid values are True and False. This parameter is optional and defaults to False.
insecure
Allows a connection via SSL without a certificate authority. Valid values are True and False, and the default is False. If the insecure parameter is set to False then the ca_file must be supplied to secure the connection.
This option should be used with caution, as it may allow man-in-the-middle (MITM) attackers to spoof the identity of the server.
filter
Specifies whether or not the user permission based filter is on or off. Valid values are True and False, and the default is False. If the filter parameter is set to False, the authentication credentials provided must be those of an administrative user. If the filter parameter is set to True, any user can be used and the Console will filter the actions available to the user based on their permissions.
debug
Specifies whether debug mode is enabled for this connection. Valid values are True and False. This parameter is optional.
You can communicate with multiple Red Hat Gluster Storage Console by creating and manipulating separate instances of the ovirtsdk.API Python class.
For a full list of methods supported by the API class, refer to the PyDoc output for the ovirtsdk.api package.
トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2025 Red Hat