python – remove rn from query result and extract values ​​into a list

I send a query like this:

    resp = http.urlopen('GET', 'https://api.appfigures.com/v2/values/time/-1/0/?client_key=12346', headers=headers)
    print('Response', str(resp.data))

The result I see is something like this

Response b'{rn  "2022-06-02": {rn    "downloads": 1,rn    "re_downloads": 34,rn    "uninstalls": 0,rn    "updates": 0,rn    "returns": 0,rn    "net_downloads": 1,rn    "promos": 0,rn    "revenue": "57.05",rn    "returns_amount": "0.00",rn    "edu_downloads": 0,rn    "gifts": 0,rn    "gift_redemptions": 0,rn    "edu_revenue": "0.00",rn    "gross_revenue": "67.12",rn    "gross_returns_amount": "0.00",rn    "gross_edu_revenue": "0.00",rn    "business_downloads": 0,rn    "business_revenue": "0.00",rn    "gross_business_revenue": "0.00",rn    "standard_downloads": 1,rn    "standard_revenue": "57.05",rn    "gross_standard_revenue": "67.12",rn    "app_downloads": 0,rn    "app_returns": 0,rn    "iap_amount": 1,rn    "iap_returns": 0,rn    "subscription_purchases": 0,rn    "subscription_returns": 0,rn    "edu_revenue": "0.00",rn    "gross_revenue": "0.00",rn    "gross_returns_amount": "0.00",rn    "gross_edu_revenue": "0.00",rn    "business_downloads": 0,rn    "business_revenue": "0.00",rn    "gross_business_revenue": "0.00",rn    "standard_downloads": 0,rn    "standard_revenue": "0.00",rn    "gross_standard_revenue": "0.00",rn    "app_downloads": 0,rn    "app_returns": 0,rn    "iap_amount": 0,rn    "iap_returns": 0,rn    "subscription_purchases": 0,rn    "subscription_returns": 0,rn    "app_revenue": "0.00",rn    "app_returns_amount": "0.00",rn    "gross_app_revenue": "0.00",rn    "gross_app_returns_amount": "0.00",rn    "iap_revenue": "0.00",rn    "iap_returns_amount": "0.00",rn    "gross_iap_revenue": "0.00",rn    "gross_iap_returns_amount": "0.00",rn    "subscription_revenue": "0.00",rn    "subscription_returns_amount": "0.00",rn    "gross_subscription_revenue": "0.00",rn    "gross_subscription_returns_amount": "0.00",rn    "date": "2022-06-03"rn  }rn}'
b'{rn  "2022-06-02": {rn    "downloads": 1,rn    "re_downloads": 34,rn    "uninstalls": 0,rn    "updates": 0,rn    "returns": 0,rn    "net_downloads": 1,rn    "promos": 0,rn    "revenue": "57.05",rn    "returns_amount": "0.00",rn    "edu_downloads": 0,rn    "gifts": 0,rn    "gift_redemptions": 0,rn    "edu_revenue": "0.00",rn    "gross_revenue": "67.12",rn    "gross_returns_amount": "0.00",rn    "gross_edu_revenue": "0.00",rn    "business_downloads": 0,rn    "business_revenue": "0.00",rn    "gross_business_revenue": "0.00",rn    "standard_downloads": 1,rn    "standard_revenue": "57.05",rn    "gross_standard_revenue": "67.12",rn    "app_downloads": 0,rn    "app_returns": 0,rn    "iap_amount": 1,rn    "iap_returns": 0,rn    "subscription_purchases": 0,rn    "subscription_returns": 0,rn    "app_revenue": "0.00",rn    "app_returns_amount": "0.00",rn    "gross_app_revenue": "0.00",rn    "gross_app_returns_amount": "0.00",rn    "app_downloads": 0,rn    "app_returns": 0,rn    "iap_amount": 0,rn    "iap_returns": 0,rn    "subscription_purchases": 0,rn    "subscription_returns": 0,rn    rn    "subscription_revenue": "0.00",rn    "subscription_returns_amount": "0.00",rn    "gross_subscription_revenue": "0.00",rn    "gross_subscription_returns_amount": "0.00",rn    "date": "2022-06-03"rn  }rn}'

The world “re_downloads” and “uninstalls” might occur several times in this output. Is it possible to extract ALL values ​​for these two keys and add them to 2 different lists?

For example, a list re_downloads[]contains all values ​​occurring in the resoponse while another list uninstalls[]contains all respective values ​​occurring in the resoponse

Edit:

Response {'2022-06-01': {'downloads': 110, 're_downloads': 82, 'uninstalls': 17, 'updates': 16, 'returns': 0, 'net_downloads': 110, 'promos': 0, 'revenue': '402.44', 'returns_amount': '0.00', 'edu_downloads': 0, 'gifts': 0, 'gift_redemptions': 0, 'edu_revenue': '0.00', 'gross_revenue': '524.92', 'gross_returns_amount': '0.00', 'gross_edu_revenue': '0.00', 'business_downloads': 0, 'business_revenue': '0.00', 'gross_business_revenue': '0.00', 'standard_downloads': 110, 'standard_revenue': '402.44', 'gross_standard_revenue': '524.92', 'app_downloads': 103, 'app_returns': 0, 'iap_amount': 7, 'iap_returns': 0, 'subscription_purchases': 0, 'subscription_returns': 0, 'app_revenue': '0.00', 'app_returns_amount': '0.00', 'gross_app_revenue': '0.00', 'gross_app_returns_amount': '0.00', 'iap_revenue': '402.44', 'iap_returns_amount': '0.00', 'gross_iap_revenue': '524.92', 'gross_iap_returns_amount': '0.00', 'subscription_revenue': '0.00', 'subscription_returns_amount': '0.00', 'gross_subscription_revenue': '0.00', 'gross_subscription_returns_amount': '0.00', 'date': '2022-06-01'}, '2022-06-02': {'downloads': 84, 're_downloads': 92, 'uninstalls': 0, 'updates': 8, 'returns': 0, 'net_downloads': 84, 'promos': 0, 'revenue': '285.24', 'returns_amount': '0.00', 'edu_downloads': 0, 'gifts': 0, 'gift_redemptions': 0, 'edu_revenue': '0.00', 'gross_revenue': '386.62', 'gross_returns_amount': '0.00', 'gross_edu_revenue': '0.00', 'business_downloads': 0, 'business_revenue': '0.00', 'gross_business_revenue': '0.00', 'standard_downloads': 84, 'standard_revenue': '285.24', 'gross_standard_revenue': '386.62', 'app_downloads': 79, 'app_returns': 0, 'iap_amount': 5, 'iap_returns': 0, 'subscription_purchases': 0, 'subscription_returns': 0, 'app_revenue': '0.00', 'app_returns_amount': '0.00', 'gross_app_revenue': '0.00', 'gross_app_returns_amount': '0.00', 'iap_revenue': '285.24', 'iap_returns_amount': '0.00', 'gross_iap_revenue': '386.62', 'gross_iap_returns_amount': '0.00', 'subscription_revenue': '0.00', 'subscription_returns_amount': '0.00', 'gross_subscription_revenue': '0.00', 'gross_subscription_returns_amount': '0.00', 'date': '2022-06-02'}, '2022-06-03': {'downloads': 0, 're_downloads': 4, 'uninstalls': 0, 'updates': 0, 'returns': 0, 'net_downloads': 0, 'promos': 0, 'revenue': '0.00', 'returns_amount': '0.00', 'edu_downloads': 0, 'gifts': 0, 'gift_redemptions': 0, 'edu_revenue': '0.00', 'gross_revenue': '0.00', 'gross_returns_amount': '0.00', 'gross_edu_revenue': '0.00', 'business_downloads': 0, 'business_revenue': '0.00', 'gross_business_revenue': '0.00', 'standard_downloads': 0, 'standard_revenue': '0.00', 'gross_standard_revenue': '0.00', 'app_downloads': 0, 'app_returns': 0, 'iap_amount': 0, 'iap_returns': 0, 'subscription_purchases': 0, 'subscription_returns': 0, 'app_revenue': '0.00', 'app_returns_amount': '0.00', 'gross_app_revenue': '0.00', 'gross_app_returns_amount': '0.00', 'iap_revenue': '0.00', 'iap_returns_amount': '0.00', 'gross_iap_revenue': '0.00', 'gross_iap_returns_amount': '0.00', 'subscription_revenue': '0.00', 'subscription_returns_amount': '0.00', 'gross_subscription_revenue': '0.00', 'gross_subscription_returns_amount': '0.00', 'date': '2022-06-03'}}
b'{rn  "2022-06-01": {rn    "downloads": 110,rn    "re_downloads": 82,rn    "uninstalls": 17,rn    "updates": 16,rn    "returns": 0,rn    "net_downloads": 110,rn    "promos": 0,rn    "revenue": "402.44",rn    "returns_amount": "0.00",rn    "edu_downloads": 0,rn    "gifts": 0,rn    "gift_redemptions": 0,rn    "edu_revenue": "0.00",rn    "gross_revenue": "524.92",rn    "gross_returns_amount": "0.00",rn    "gross_edu_revenue": "0.00",rn    "business_downloads": 0,rn    "business_revenue": "0.00",rn    "gross_business_revenue": "0.00",rn    "standard_downloads": 110,rn    "standard_revenue": "402.44",rn    "gross_standard_revenue": "524.92",rn    "app_downloads": 103,rn    "app_returns": 0,rn    "iap_amount": 7,rn    "iap_returns": 0,rn    "subscription_purchases": 0,rn    "subscription_returns": 0,rn    "app_revenue": "0.00",rn    "app_returns_amount": "0.00",rn    "gross_app_revenue": "0.00",rn    "gross_app_returns_amount": "0.00",rn    "iap_revenue": "402.44",rn    "iap_returns_amount": "0.00",rn    "gross_iap_revenue": "524.92",rn    "gross_iap_returns_amount": "0.00",rn    "subscription_revenue": "0.00",rn    "subscription_returns_amount": "0.00",rn    "gross_subscription_revenue": "0.00",rn    "gross_subscription_returns_amount": "0.00",rn    "date": "2022-06-01"rn  },rn  "2022-06-02": {rn    "downloads": 84,rn    "re_downloads": 92,rn    "uninstalls": 0,rn    "updates": 8,rn    "returns": 0,rn    "net_downloads": 84,rn    "promos": 0,rn    "revenue": "285.24",rn    "returns_amount": "0.00",rn    "edu_downloads": 0,rn    "gifts": 0,rn    "gift_redemptions": 0,rn    "edu_revenue": "0.00",rn    "gross_revenue": "386.62",rn    "gross_returns_amount": "0.00",rn    "gross_edu_revenue": "0.00",rn    "business_downloads": 0,rn    "business_revenue": "0.00",rn    "gross_business_revenue": "0.00",rn    "standard_downloads": 84,rn    "standard_revenue": "285.24",rn    "gross_standard_revenue": "386.62",rn    "app_downloads": 79,rn    "app_returns": 0,rn    "iap_amount": 5,rn    "iap_returns": 0,rn    "subscription_purchases": 0,rn    "subscription_returns": 0,rn    "app_revenue": "0.00",rn    "app_returns_amount": "0.00",rn    "gross_app_revenue": "0.00",rn    "gross_app_returns_amount": "0.00",rn    "iap_revenue": "285.24",rn    "iap_returns_amount": "0.00",rn    "gross_iap_revenue": "386.62",rn    "gross_iap_returns_amount": "0.00",rn    "subscription_revenue": "0.00",rn    "subscription_returns_amount": "0.00",rn    "gross_subscription_revenue": "0.00",rn    "gross_subscription_returns_amount": "0.00",rn    "date": "2022-06-02"rn  },rn  "2022-06-03": {rn    "downloads": 0,rn    "re_downloads": 4,rn    "uninstalls": 0,rn    "updates": 0,rn    "returns": 0,rn    "net_downloads": 0,rn    "promos": 0,rn    "revenue": "0.00",rn    "returns_amount": "0.00",rn    "edu_downloads": 0,rn    "gifts": 0,rn    "gift_redemptions": 0,rn    "edu_revenue": "0.00",rn    "gross_revenue": "0.00",rn    "gross_returns_amount": "0.00",rn    "gross_edu_revenue": "0.00",rn    "business_downloads": 0,rn    "business_revenue": "0.00",rn    "gross_business_revenue": "0.00",rn    "standard_downloads": 0,rn    "standard_revenue": "0.00",rn    "gross_standard_revenue": "0.00",rn    "app_downloads": 0,rn    "app_returns": 0,rn    "iap_amount": 0,rn    "iap_returns": 0,rn    "subscription_purchases": 0,rn    "subscription_returns": 0,rn    "app_revenue": "0.00",rn    "app_returns_amount": "0.00",rn    "gross_app_revenue": "0.00",rn    "gross_app_returns_amount": "0.00",rn    "iap_revenue": "0.00",rn    "iap_returns_amount": "0.00",rn    "gross_iap_revenue": "0.00",rn    "gross_iap_returns_amount": "0.00",rn    "subscription_revenue": "0.00",rn    "subscription_returns_amount": "0.00",rn    "gross_subscription_revenue": "0.00",rn    "gross_subscription_returns_amount": "0.00",rn    "date": "2022-06-03"rn  }rn}'

Leave a Comment