class formats(object): def __init__(self): self.normalizer = Formats(GOOGLE_USER, GOOGLE_PASS) self.categories = set() def __call__(self, client, pkg): out_res = [] for res in pkg.get('resources', []): if res.get('format') is not None: data = self.normalizer.get(res.get('format'), source_hint=pkg.get('ckan_url')) if data.get('mimetype'): res['format'] = data.get('mimetype') out_res.append(res) pkg['resources'] = out_res return pkg
def __init__(self): self.normalizer = Formats(GOOGLE_USER, GOOGLE_PASS) self.categories = set()