Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hitting TypeError when trying to fetch secrets in python 3.8 #450

Open
Kirandeep-Singh opened this issue Apr 26, 2022 · 2 comments
Open
Labels
SDK Issue pertains to the SDK itself and not specific to any service

Comments

@Kirandeep-Singh
Copy link

Hi Guys

I am facing an issue while using the sdk for python version 3.8.
Same piece of code runs fine without any issues for Python 3.6.

import oci
region="test"
config_file=".oci_config_file"
config = oci.config.from_file(config_file, profile_name=region.upper())
vault_client = oci.vault.VaultsClient(config)
argus_compartment_id=config.get("argus_comp_id")
vault_id=config.get("vault_id")
secret_list = vault_client.list_secrets(name = "Dummy_secret", compartment_id=argus_compartment_id, vault_id=vault_id, lifecycle_state="ACTIVE")

Error:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.8/site-packages/oci/vault/vaults_client.py", line 947, in list_secrets
return self.base_client.call_api(
File "/usr/lib/python3.8/site-packages/oci/base_client.py", line 472, in call_api
response = self.request(request, allow_control_chars)
File "/usr/lib/python3.8/site-packages/circuitbreaker.py", line 52, in wrapper
return self.call(function, *args, **kwargs)
File "/usr/lib/python3.8/site-packages/circuitbreaker.py", line 67, in call
result = func(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/oci/base_client.py", line 570, in request
response = self.session.request(
File "/usr/lib/python3.8/site-packages/oci/_vendor/requests/sessions.py", line 547, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3.8/site-packages/oci/_vendor/requests/sessions.py", line 660, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3.8/site-packages/oci/_vendor/requests/adapters.py", line 446, in send
resp = conn.urlopen(
File "/usr/lib/python3.8/site-packages/oci/_vendor/urllib3/connectionpool.py", line 693, in urlopen
conn = self._get_conn(timeout=pool_timeout)
File "/usr/lib/python3.8/site-packages/oci/_vendor/urllib3/connectionpool.py", line 285, in _get_conn
return conn or self._new_conn()
File "/usr/lib/python3.8/site-packages/oci/_vendor/urllib3/connectionpool.py", line 994, in _new_conn
conn = self.ConnectionCls(
File "/usr/lib/python3.8/site-packages/oci/base_client.py", line 160, in __init__
super(OCIConnection, self).__init__(*args, **kwargs)
TypeError: object.__init__() takes exactly one argument (the instance to initialize)
``

When Tried with version 3.6, it runs absolutely smooth.

Awaiting a response on this.

@jodoglevy jodoglevy added the SDK Issue pertains to the SDK itself and not specific to any service label Apr 27, 2022
@adizohar
Copy link
Member

I checked with Python 3.9 and Python 3.11 and it worked well

> python3
Python 3.11.1 (main, Jan  6 2023, 10:53:52) [GCC 8.5.0 20210514 (Red Hat 8.5.0-15.0.2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import oci
>>> config = oci.config.from_file()
>>> vault_client = oci.vault.VaultsClient(config)
>>> vault_id="ocid1.vault.oc1.iad.bbpqq6iuaacuu.abuwcljrqlei3dlmyxm43fttfiiod4ttulxxxxxxxx"
>>> compartment_id = config['tenancy']
>>> secret_list = vault_client.list_secrets(name = "test_secret", compartment_id=compartment_id, vault_id=vault_id, lifecycle_state="ACTIVE")
>>> secret_list.data
[{
  "compartment_id": "xxxxxxxx",
  "description": "test_secret",
  "freeform_tags": {},
  "id": "ocid1.vaultsecret.oc1.iad.xxxxxx",
  "key_id": "ocid1.key.oc1.iad.bbpqq6iuaacuu.xxxxxx",
  "lifecycle_details": null,
  "lifecycle_state": "ACTIVE",
  "secret_name": "test_secret",
  "time_created": "2023-02-10T12:26:12.201000+00:00",
  "time_of_current_version_expiry": null,
  "time_of_deletion": null,
  "vault_id": "ocid1.vault.oc1.iad.bbpqq6iuaacuu.xxxxxxx"
}]

@bhagwatvyas
Copy link
Member

@Kirandeep-Singh are you still facing this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SDK Issue pertains to the SDK itself and not specific to any service
Projects
None yet
Development

No branches or pull requests

4 participants