A Python program which parses the data in the coblob database and transforms into a format which the co-data project can use. One of the main goals of this project is to reduce the load on the CPU in the co-data project.
https://www.craigoates.net/Software/project/17
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
475 B
21 lines
475 B
import requests |
|
import json |
|
|
|
def get_data(url): |
|
return requests.get(url) |
|
|
|
def get_json(url): |
|
return requests.get(url).json() |
|
|
|
def store_json(data, file_name): |
|
with open (file_name, "w") as outfile: |
|
json.dump(data, outfile, indent = 4) |
|
|
|
def load_json(file_name): |
|
with open(file_name, "r") as infile: |
|
data = json.load(infile) |
|
return data |
|
|
|
def store_txt(data, file_name): |
|
with open(file_name, "w") as outfile: |
|
outfile.write(data)
|
|
|