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

Problem connecting using windows laptop on company network, ok on mac #917

Closed
jlobeltest opened this issue May 18, 2023 · 3 comments · Fixed by #918
Closed

Problem connecting using windows laptop on company network, ok on mac #917

jlobeltest opened this issue May 18, 2023 · 3 comments · Fixed by #918

Comments

@jlobeltest
Copy link

Hello,

I'm just installing tm1py and trying to do a simple connection. I can run the following test on my macbook not on vpn or company locked down windows pc:

from TM1py import TM1Service

with TM1Service(
base_url="https://esnonprod.planning-analytics.cloud.ibm.com/tm1/api/QUBEPROD/",
user="companysite_tm1_automation",
namespace="LDAP",
password="mypassword",
ssl=True,
verify=True,
async_requests_mode=True) as tm1:
print(tm1.server.get_product_version())

However, when I try to run it on the windows pc, I get these errors. I have tried changing the site and/or the password, and I get different results. I can see from tm1login.log that it is connecting. On macbook, running python3.9. have tried with both 3.9 and 3.10 on pc. Any ideas?

Error output
Traceback (most recent call last):
File "C:\Users\lobelj\Downloads\tm1py-samples-master\tm1py-samples-master\testcon2.py", line 3, in
with TM1Service(
File "C:\Users\lobelj\AppData\Local\Programs\Python\Python310\lib\site-packages\TM1py\Services\TM1Service.py", line 16, in init
self._tm1_rest = RestService(**kwargs)
File "C:\Users\lobelj\AppData\Local\Programs\Python\Python310\lib\site-packages\TM1py\Services\RestService.py", line 226, in init
self.connect()
File "C:\Users\lobelj\AppData\Local\Programs\Python\Python310\lib\site-packages\TM1py\Services\RestService.py", line 246, in connect
self._start_session(
File "C:\Users\lobelj\AppData\Local\Programs\Python\Python310\lib\site-packages\TM1py\Services\RestService.py", line 420, in _start_session
response = self.GET(url=url, headers=additional_headers)
File "C:\Users\lobelj\AppData\Local\Programs\Python\Python310\lib\site-packages\TM1py\Services\RestService.py", line 85, in wrapper
response = self.build_response_from_raw_bytes(response.content)
File "C:\Users\lobelj\AppData\Local\Programs\Python\Python310\lib\site-packages\TM1py\Services\RestService.py", line 619, in build_response_from_raw_bytes
urllib_response = RestService.urllib3_response_from_bytes(data)
File "C:\Users\lobelj\AppData\Local\Programs\Python\Python310\lib\site-packages\TM1py\Services\RestService.py", line 615, in urllib3_response_from_bytes
return urllib3.HTTPResponse.from_httplib(response)
AttributeError: type object 'HTTPResponse' has no attribute 'from_httplib'

@josrobins
Copy link
Collaborator

What version of urblib3 are you running?

@jlobeltest
Copy link
Author

pip freeze reports 2.0.2 on pc

on macbook, it's 1.2.11

i just ran this command to downgrade it to 1.2.11 on the pc
pip -install urllib3=1.22.0

Voila - tmypy can now connect! thanks for your help.

@MariusWirtz
Copy link
Collaborator

This issue is due to a breaking change in urllib3 urllib3/urllib3#2648

The function from_httplib has been removed in the HTTPResponse class in urllib3.
This only affects TM1py when using urllib3 > 2.0 in conjunction with the async_requests_mode.

I will provide a fix for this. TM1py can implement the from_httplib function that was previously implemented in urllib3.

MariusWirtz added a commit that referenced this issue May 21, 2023
Impement function to create urllib3.HTTPResponse
based off bytes string from async_requests_mode response

Fixes #917
Fixes #914
MariusWirtz added a commit that referenced this issue May 23, 2023
Impement function to create urllib3.HTTPResponse
based off bytes string from async_requests_mode response

Fixes #917
Fixes #914
MariusWirtz added a commit that referenced this issue May 23, 2023
Impement function to create urllib3.HTTPResponse
based off bytes string from async_requests_mode response

Fixes #917
Fixes #914
MariusWirtz added a commit that referenced this issue May 23, 2023
Impement function to create urllib3.HTTPResponse
based off bytes string from async_requests_mode response

Fixes #917
Fixes #914
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants