Replies: 3 comments 10 replies
-
Yes. Imagine this scenario:
If TM1py can perform the task in no time, it would be unpleasant and unreasonable for the users to wait 3-5 seconds for the CAM authentication. In that scenario, it can be useful to persist your session on the server, so that it can be re-used for multiple runs. Of course, once the session times out you have to re-authenticate. import time
from TM1py import TM1Service
tm1 = TM1Service(address="", port=12354, ssl=True, user="admin", password="apple")
tm1.save_to_file("tm1conn")
time.sleep(5)
tm1: TM1Service = TM1Service.restore_from_file("tm1conn")
# session timeout
if not tm1.connection.is_connected():
tm1.re_authenticate()
print(tm1.server.get_server_name())
|
Beta Was this translation helpful? Give feedback.
-
If you logout you will never be able to use a saved session.
…Sent from my mobile device
On Nov 3, 2022 12:45 AM, tm1sir ***@***.***> wrote:
Thanks, @MariusWirtz<https://github.com/MariusWirtz> your code works for me. Looks like I need to logout explicitly after creating a saved session so that I can re auth again from a timeout saved session. Something like that
import time
from TM1py import TM1Service
tm1 = TM1Service(address="", port=12354, ssl=True, user="admin", password="apple")
tm1.save_to_file("tm1conn")
**tm1.logout()**
time.sleep(5)
tm1: TM1Service = TM1Service.restore_from_file("tm1conn")
# session timeout
if not tm1.connection.is_connected():
tm1.re_authenticate()
print(tm1.server.get_server_name())
I will keep testing.
—
Reply to this email directly, view it on GitHub<#822 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AEK7GZVDRQK7L6S6EPYOLOTWGM7MRANCNFSM6AAAAAARUTHEFY>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Just to add some more context, In some TM1py versions the pickled file had the credentials stored in plain format. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, @MariusWirtz Could you elaborate some use cases of this function to avoid multiple authentication with TM1? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions