Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
987 B
1
Indexable
Never
import numpy
import pandas as pd
from urllib.request import urlopen
import json
import time

x = 1

def main():
    while True:
        commentsUrl = r'https://bossan.musikhjalpen.se/server/fundraisers/donations/6yNjWU30ZZ20ZK8vRKDaaO/0/?fbclid=IwAR0brZ4ZUQ7XzY5W0CzZR0qnlKFisl77fONJV4j-5-UVTDOHChaxqDlAAL4'
        amountUrl = r'https://bossan.musikhjalpen.se/server/fundraisers/6yNjWU30ZZ20ZK8vRKDaaO?fields[]=amount&fields=prev_amount'


        amountResponse = urlopen(amountUrl)
        response = urlopen(commentsUrl)


        amountData = json.loads(amountResponse.read())
        responseData = json.loads(response.read())
        amountSer = pd.Series(amountData)
        responseSer = pd.Series(responseData)


        responseSeries = pd.Series(responseData)
        amountSer.to_json(r'C:\Amount.json')
        responseSeries.to_json(r'C:\Comments.json')
        
        
        x += 1
        print(x)
        time.sleep(1)
        
if __name__ == "__main__":
    main()