Breaking PyPI package changes in Kameleo 2.11.1

  • Created

When we published the 2.11.1 version of kameleo.local_api_client PyPI package we made a couple of breaking changes compared to 2.11.0. These changes were necessary, so in case of exceptions developers can see more detailed error messages. We tried to make these changes, so you won't need to change anything in your code. In this document, we showcase the 3 most common issues that can occur in case of updating from 2.11.0 to 2.11.1.

Wrong imports

Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\app.py", line 1, in <module>
    from kameleo.local_api_client.kameleo_local_api_client import KameleoLocalApiClient
ModuleNotFoundError: No module named 'kameleo.local_api_client.kameleo_local_api_client'

If you see this error, you need to change the imports a bit. 

Replace this line

from kameleo.local_api_client.kameleo_local_api_client import KameleoLocalApiClient

With this

from kameleo.local_api_client import KameleoLocalApiClient

Error on KameleoLocalApiClient init

Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\app.py", line 11, in <module>
    client = KameleoLocalApiClient(f'http://localhost:{kameleo_port}')
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: KameleoLocalApiClient.__init__() takes 1 positional argument but 2 were given

From the 2.11.1 version of the package, this conctructor takes 2 arguments, so you can only change the client's retry policy.

Replace this line

client = KameleoLocalApiClient(f'http://localhost:{kameleo_port}')

With this

client = KameleoLocalApiClient(
    endpoint=f'http://localhost:{kameleo_port}',
    retry_total=0
)

No more ProblemResponseException

Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\app.py", line 50, in <module>
    except ProblemResponseException as e:
           ^^^^^^^^^^^^^^^^^^^^^^^^
NameError: name 'ProblemResponseException' is not defined

You can't use the ProblemResponseException in your try-except statement anymore.

except ProblemResponseException as e:

Use regular Exception instead

except Exception as e:
    print(e)

Was this article helpful?

0 out of 0 found this helpful