From f8c6e40555200e1e21964de5dce30ab7f42499a8 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 14 May 2019 19:39:46 -0300 Subject: Coding style --- ckandumper | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ckandumper b/ckandumper index 3f8f08e..1facd9c 100755 --- a/ckandumper +++ b/ckandumper @@ -23,7 +23,7 @@ import argparse import sys, os, subprocess, pycurl, json from urllib.parse import urlencode -class ckandumper: +class CkanDumper: """Dumps CKAN data: metadata plus entire datasets""" def __init__(self, args): @@ -50,7 +50,7 @@ class ckandumper: elif os.path.exists(dest) and not os.path.isdir(dest): raise ValueError('File exists and is not a folder:' + dest) - def loadJSON(self, file): + def load_json(self, file): descriptor = open(file) data = json.load(descriptor) file.close() @@ -69,7 +69,7 @@ class ckandumper: # Groups # self.download(self.url + self.group_list, group_list) - groups = self.loadJSON(group_list) + groups = self.load_json(group_list) for group in groups['result']: group_folder = self.dest + os.sep + 'groups' + os.sep + group @@ -82,7 +82,7 @@ class ckandumper: # Tags # self.download(self.url + self.tag_list, tag_list) - tags = self.loadJSON(tag_list) + tags = self.load_json(tag_list) for tag in tags['result']: tag_folder = self.dest + os.sep + 'tags' + os.sep + tag @@ -96,7 +96,7 @@ class ckandumper: # Packages # self.download(self.url + self.package_list, package_list) - packages = self.loadJSON(package_list) + packages = self.load_json(package_list) for package in packages['result']: package_folder = self.dest + os.sep + 'packages' + os.sep + package @@ -106,7 +106,7 @@ class ckandumper: print("Downloading " + self.url + self.package_show + 'id=' + package + '...') self.download(self.url + self.package_show + urlencode({ 'id': package }, False, '', 'utf-8'), package_file) - contents = self.loadJSON(package_file) + contents = self.load_json(package_file) for resource in contents['result']['resources']: #if resource['name'] != None: @@ -138,5 +138,5 @@ if __name__ == "__main__": args = parser.parse_args() # Dispatch - ckan = ckandumper(args) + ckan = CkanDumper(args) ckan.dump() -- cgit v1.2.3