Compare commits

..

No commits in common. "7dbc4ae55cc8275eeda06240e42f5b7a55a5f532" and "f874ed1206139b157b2b1a529adef7a572a24b3d" have entirely different histories.

1 changed files with 2 additions and 13 deletions

View File

@ -23,7 +23,6 @@ import MySQLdb as mysql
from collections import defaultdict
from typing import Any, Dict, List
import civicrmapi4
from civicrmapi4.civicrmapi4 import APIv4
import phpserialize
@ -223,16 +222,6 @@ def parse_arguments() -> argparse.Namespace:
return parser.parse_args()
def wrap_api_get(api, obj, args=None):
if args is None:
args = []
try:
return api.get(obj, args)
except civicrmapi4.civicrmapi4.CallFailed:
logging.error("Could not fetch {}".format(obj))
return []
def main() -> int:
args = parse_arguments()
@ -272,14 +261,14 @@ def main() -> int:
for table in DUMP_TRIVIAL:
output = args.output / (table + ".json")
data = wrap_api_get(api, table)
data = api.get(table)
if data:
print("dumping", table)
with output.open("w") as of:
of.write(json.dumps(data))
# dump org contacts
output = args.output / ("Contact.json")
data = wrap_api_get(api, "Contact", where=[["contact_sub_type", "CONTAINS", "Political_Party"]])
data = api.get("Contact", where=[["contact_sub_type", "CONTAINS", "Political_Party"]])
if data:
print("dumping parties")
with output.open("w") as of: