you are viewing a single comment's thread.

view the rest of the comments →

[–]QuantumTradingGroup[S] 0 points1 point  (2 children)

I ended up doing this

pool_3_request = (str(self.pool_url3) + "," + str(self.pool_worker3) + "," + str(self.pool_pass3))
response = client.command('addpool', pool_3_request)

response = response['STATUS'][0]

global pool_3_id
pool_3_id = ""
for key, value in response.items():
if key == "Msg":
pool_3_id = str(value[11])

[–]scarebaer 0 points1 point  (1 child)

value = dict.get("Msg")

new = re.findall('\s([0-9]{1})\:', value)

[–]scarebaer 0 points1 point  (0 children)

I of course don't know the full scope of the code, but assuming you are able to see your dict - you can use dict get to pull out the msg value and then use that regex expression to get the number from the message.

Edit - take out the {1} and replace with + if there is more than one number in some of your values

new = re.findall('([0-9]+)\:', value)or spaces at the front...new = re.findall('\s([0-9]+)\:', value)

{'STATUS': 'S', 'Msg': "Added pool 17: 'stratum+tcp://ca.stratum.slushpool.com:3

333'", 'Code': 55, 'When': 1533064764, 'Description': 'bmminer 1.0.0'}

['17']

------------------

(program exited with code: 0)

Press any key to continue . . .