oracle / oracle/oci-python-sdk

Hitting TypeError when trying to fetch secrets in python 3.8

Open
#450 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

SDK
Dominant language
Python
Stars
474
Forks
321
Avg merge
23m
Merged PRs (30d)
4

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Python 3.8 failure through oci/vault/vaults_client.py and trace the request path into oci/base_client.py, including the vendored requests and urllib3 layers shown in the traceback. Compare the Python 3.6 and 3.8 environments; done means list_secrets completes successfully on Python 3.8 with regression coverage if the repository has tests for this path.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.