Skip to content

Commit d93b451

Browse files
idonaaman123ido
andauthored
add account id and change user structure (#143)
Co-authored-by: ido <ido@ip-192-168-1-78.eu-central-1.compute.internal>
1 parent c70c8d4 commit d93b451

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ async def main():
6565
await memphis.connect(
6666
host="<memphis-host>",
6767
username="<application-type username>",
68+
account_id="<account_id>", # You can find it on the profile page in the Memphis UI. This field should be sent only on the cloud version of Memphis, otherwise it will be ignored
6869
connection_token="<broker-token>", # you will get it on application type user creation
6970
password="<string>", # depends on how Memphis deployed - default is connection token-based authentication
7071
port="<port>", # defaults to 6666

memphis/memphis.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ async def connect(
9494
self,
9595
host: str,
9696
username: str,
97+
account_id: int = 1,
9798
connection_token: str = "",
9899
password: str = "",
99100
port: int = 6666,
@@ -109,6 +110,7 @@ async def connect(
109110
Args:
110111
host (str): memphis host.
111112
username (str): user of type root/application.
113+
account_id (int): You can find it on the profile page in the Memphis UI. This field should be sent only on the cloud version of Memphis, otherwise it will be ignored
112114
connection_token (str): connection token.
113115
password (str): depends on how Memphis deployed - default is connection token-based authentication.
114116
port (int, optional): port. Defaults to 6666.
@@ -122,6 +124,7 @@ async def connect(
122124
"""
123125
self.host = self.__normalize_host(host)
124126
self.username = username
127+
self.account_id = account_id
125128
self.connection_token = connection_token
126129
self.password = password
127130
self.port = port
@@ -159,7 +162,7 @@ async def connect(
159162
if self.connection_token != "":
160163
connection_opts["token"]=self.connection_token
161164
else:
162-
connection_opts["user"]=self.username
165+
connection_opts["user"]=self.username + "$" + str(self.account_id)
163166
connection_opts["password"]=self.password
164167

165168
self.broker_manager = await broker.connect(**connection_opts)

0 commit comments

Comments
 (0)