summaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools/importers/common.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-12-24 16:04:53 -0800
committerBryan Newbold <bnewbold@robocracy.org>2018-12-24 16:15:36 -0800
commit457c1612e29730e5b9ee2820c3ea813a1d2dd405 (patch)
tree1f3bd14dd0872bd2db752142b1f35cb0296635ae /python/fatcat_tools/importers/common.py
parentb86e007b7469ebb22a806d38aca0bccf9078e80d (diff)
downloadfatcat-457c1612e29730e5b9ee2820c3ea813a1d2dd405.tar.gz
fatcat-457c1612e29730e5b9ee2820c3ea813a1d2dd405.zip
python impl of API ident harmonization
Diffstat (limited to 'python/fatcat_tools/importers/common.py')
-rw-r--r--python/fatcat_tools/importers/common.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/python/fatcat_tools/importers/common.py b/python/fatcat_tools/importers/common.py
index 65976a21..e31cabf8 100644
--- a/python/fatcat_tools/importers/common.py
+++ b/python/fatcat_tools/importers/common.py
@@ -54,11 +54,11 @@ class FatcatImporter:
print("Processed {} lines, inserted {}, updated {}.".format(
self.counts['processed_lines'], self.counts['insert'], self.counts['update']))
- def create_row(self, row, editgroup=None):
+ def create_row(self, row, editgroup_id=None):
# sub-classes expected to implement this
raise NotImplementedError
- def create_batch(self, rows, editgroup=None):
+ def create_batch(self, rows, editgroup_id=None):
# sub-classes expected to implement this
raise NotImplementedError
@@ -68,14 +68,14 @@ class FatcatImporter:
fatcat_client.Editgroup(editor_id='aaaaaaaaaaaabkvkaaaaaaaaae'))
i = 0
for i, row in enumerate(source):
- self.create_row(row, editgroup=eg.id)
+ self.create_row(row, editgroup_id=eg.editgroup_id)
if i > 0 and (i % group_size) == 0:
- self.api.accept_editgroup(eg.id)
+ self.api.accept_editgroup(eg.editgroup_id)
eg = self.api.create_editgroup(
fatcat_client.Editgroup(editor_id='aaaaaaaaaaaabkvkaaaaaaaaae'))
self.counts['processed_lines'] += 1
if i == 0 or (i % group_size) != 0:
- self.api.accept_editgroup(eg.id)
+ self.api.accept_editgroup(eg.editgroup_id)
def process_batch(self, source, size=50, decode_kafka=False):
"""Reads and processes in batches (not API-call-per-)"""
@@ -85,7 +85,7 @@ class FatcatImporter:
self.counts['processed_lines'] += len(rows)
eg = self.api.create_editgroup(
fatcat_client.Editgroup(editor_id='aaaaaaaaaaaabkvkaaaaaaaaae'))
- self.create_batch(rows, editgroup=eg.id)
+ self.create_batch(rows, editgroup_id=eg.editgroup_id)
def process_csv_source(self, source, group_size=100, delimiter=','):
reader = csv.DictReader(source, delimiter=delimiter)