MicroStrategy / mstrio-py

Python integration for MicroStrategy
Apache License 2.0
90 stars 60 forks source link

connection fails due to invalid object reference Retry.DEFAULT_ALLOWED_METHODS, #56

Closed pawelgnatowski closed 2 years ago

pawelgnatowski commented 3 years ago

when trying to connect to SSL enabled Library server it fails due to reference for retry object in connection.py:

commenting out "allowed_methods" actually makes the connection to work. retry = Retry( total=retries, read=retries, connect=retries, backoff_factor=backoff_factor, status_forcelist=status_forcelist,

allowed_methods=Retry.DEFAULT_ALLOWED_METHODS,

        raise_on_status=False,
    )

p@dev-server:~/vsProjects/pythonPlayground$ /usr/bin/python3 /home/p/vsProjects/pythonPlayground/mstrio-py/connet.py Traceback (most recent call last): File "/home/p/vsProjects/pythonPlayground/mstrio-py/connet.py", line 14, in <module> conn = Connection(base_url, mstr_username, mstr_password, application_id=application_id,ssl_verify=False) File "/home/p/vsProjects/pythonPlayground/mstrio-py/mstrio/connection.py", line 105, in __init__ self.session = self.__configure_session(ssl_verify, certificate_path, proxies) File "/home/p/vsProjects/pythonPlayground/mstrio-py/mstrio/connection.py", line 356, in __configure_session allowed_methods=Retry.DEFAULT_ALLOWED_METHODS, AttributeError: type object 'Retry' has no attribute 'DEFAULT_ALLOWED_METHODS'

ignacyhologa commented 3 years ago

Hi pawelgnatowski, This has been fixed inn the latest release ;)

pawelgnatowski commented 3 years ago

Okay then. Please close.

SamiRehmanNostra commented 3 years ago

I just had a similar issue trying to create a connection to MSTR server:

File "/path/tofile/cube_refresh_operator.py", line 62, in execute
    connection = Connection(base_url, username, password, application_name=self.app_name,

File "/home/ubuntu/mstrio_env/lib/python3.8/site-packages/mstrio/connection.py", line 162, in __init__
    self.session = self.__configure_session(ssl_verify, certificate_path, proxies)

File "/home/ubuntu/mstrio_env/lib/python3.8/site-packages/mstrio/connection.py", line 415, in __configure_session
    allowed_methods=Retry.DEFAULT_ALLOWED_METHODS,

AttributeError: type object 'Retry' has no attribute 'DEFAULT_ALLOWED_METHODS'

Please do note that the virtual env has mstrio-py working when invoked from a file independently. Only causes an issue when the code is scheduled to run in Airflow.

urszulajaczewska commented 3 years ago

Hi @SamiRehmanNostra what version of urllib3 library do you use? In older versions class Retry didn't have DEFAULT_ALLOWED_METHODS attribute.

SamiRehmanNostra commented 3 years ago

Hi @urszulajaczewska ,

I am using urllib3==1.26.6 and I just double checked and it does have the DEFAULT_ALLOWED_METHODS attribute.

Thank you, Sami

urszulajaczewska commented 3 years ago

Hi @SamiRehmanNostra, I'd like you to check one more thing. Do you use the latest mstrio version? If not, can you upgrade it and check again if the error occurs?

urszulajaczewska commented 2 years ago

Hi @SamiRehmanNostra, do you still have this issue with latest mstrio version?

SamiRehmanNostra commented 2 years ago

Hi @urszulajaczewska ,

I didn't realise there was a new release. I'll try it again with the latest version

Regards, Sami

urszulajaczewska commented 2 years ago

@SamiRehmanNostra I'd be grateful for further feedback, once you've retested this issue. Thank you, Ula

SamiRehmanNostra commented 2 years ago

Hi There @urszulajaczewska ,

I have upgraded mstrio to the latest version and after my testing today, the issues seems to have eradicated. Thank you for your help !

Best regards, Sami