My take:
import sys import requests import json import re trx = {} nex = [ 'https://gist.githubusercontent.com/jorinvo/6f68380dd07e5db3cf5fd48b2465bb04/raw/c02b1e0b45ecb2e54b36e4410d0631a66d474323/fd0d929f-966f-4d1a-89cd-feee5a1c5347.json' ] rgx = r".*\$([0-9]+)[,.]{1}([0-9]+)[^0-9]*" def getAmount(s): global rgx mtc = re.search(rgx, s) intpart = mtc.group(1) decimalpart = mtc.group(2) return float("{}.{}".format(intpart, decimalpart)) while len(nex) > 0: url = nex.pop() req = requests.get(url) jsn = req.json() for link in jsn['links']: nex.append(link) idd = jsn['id'] trx[idd] = jsn['content'] sum = 0 for i in trx.keys(): amount = getAmount(trx[i]) sum += amount print(sum)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
My take: