33
loading...
This website collects cookies to deliver better user experience
openssl genrsa -out oci-api-key -aes128 2048
chmod go-rwx oci-api-key
openssl rsa -pubout -in oci-api-key -out oci-api-key.pub
56:73:ff:44:8f:b3:c3:1d:58:12:a8:1f:ff:ff:aa:66
☁ .oci python --version
Python 3.9.7
☁ .oci
This is the Python SDK for Oracle Cloud Infrastructure. Python 3.6, 3.7, 3.8 and 3.9 are supported.
It is highly recommended that a Python virtual environment be used when installing oci.
☁ oci-sdk-python ls
☁ oci-sdk-python python -m venv ocisdk
☁ oci-sdk-python ls
ocisdk
☁ oci-sdk-python source ocisdk/bin/activate
(ocisdk) ☁ oci-sdk-python python -m pip install --upgrade pip
Requirement already satisfied: pip in ./ocisdk/lib/python3.9/site-packages (21.2.4)
Collecting pip
Downloading pip-21.3.1-py3-none-any.whl (1.7 MB)
|████████████████████████████████| 1.7 MB 1.6 MB/s
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.2.4
Uninstalling pip-21.2.4:
Successfully uninstalled pip-21.2.4
Successfully installed pip-21.3.1
(ocisdk) ☁ oci-sdk-python
(ocisdk) ☁ oci-sdk-python pip install oci
...
Installing collected packages: pycparser, cffi, six, cryptography, pytz, python-dateutil, pyOpenSSL, circuitbreaker, certifi, oci
Running setup.py install for circuitbreaker ... done
Successfully installed certifi-2021.10.8 cffi-1.15.0 circuitbreaker-1.3.2 cryptography-3.4.7 oci-2.52.1 pyOpenSSL-19.1.0 pycparser-2.21 python-dateutil-2.8.2 pytz-2021.3 six-1.16.0
brew update && brew install oci-cli
oci --version
oci setup config
~/.oci
cd
cd .oci
vi config
[DEFAULT]
user = <user-ocid>
fingerprint = <fingerprint from your user API key >
tenancy = <tenancy-id or rootCompartment-id>
region = us-phoenix-1
key_file = <the full path to your private key file in pem format>
-rw-------
(ocisdk) ☁ oci-sdk-python python
>>> import oci
>>> config = oci.config.from_file("~/.oci/config", "DEFAULT2")
>>> identity = oci.identity.identityClient(config)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'oci.identity' has no attribute 'identityClient'
>>> identity = oci.identity.IdentityClient(config)
>>> availability_domains_list = identity.list_availability_domains(config['tenancy']).data
>>> for availability_domain in availability_domains_list:
... print('AD: ' + str(availability_domain.name))
...
//look for your results
>>>
You can find information on any known issues with the SDK here and under the “Issues” tab of this project’s Github Repository