def _get_json_from_tarfile(tarfile, json_name): json_file = (tarfile.extractfile( tarfile.getmember(json_name)).read().decode("utf8")) return json.loads(json_file)
def readData(self, station): dataPath = os.path.expanduser("~/Downloads/Weather/ghcnd_all.tar.gz") with tarfile.open(dataPath) as alltar: if station: stationFile = tarfile.getmember(station + ".dly") tarfile.extract(station, "/tmp")