Skip to content

Commit af84122

Browse files
authored
Merge pull request #13 from uc-cdis/submit_file
fixed res to json_res
2 parents 75dbd31 + 81fb369 commit af84122

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

gen3/submission.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,9 @@ def submit_file(self, project_id, filename, chunk_size=30, row_offset=0):
334334
df = pd.read_csv(filename, header=0, sep="\t", dtype=str).fillna("")
335335
else:
336336
raise Gen3UserError("Please upload a file in CSV, TSV, or XLSX format.")
337-
df.rename(columns = {c: c.lstrip('*') for c in df.columns}, inplace = True) # remove any leading asterisks in the DataFrame column names
337+
df.rename(
338+
columns={c: c.lstrip("*") for c in df.columns}, inplace=True
339+
) # remove any leading asterisks in the DataFrame column names
338340

339341
# Check uniqueness of submitter_ids:
340342
if len(list(df.submitter_id)) != len(list(df.submitter_id.unique())):
@@ -411,14 +413,14 @@ def submit_file(self, project_id, filename, chunk_size=30, row_offset=0):
411413
if "message" in json_res and "code" not in json_res:
412414
print(
413415
"\t No code in the API response for Chunk {}: {}".format(
414-
str(count), res.get("message")
416+
str(count), json_res.get("message")
415417
)
416418
)
417-
print("\t {}".format(str(res.get("transactional_errors"))))
419+
print("\t {}".format(str(json_res.get("transactional_errors"))))
418420
results["responses"].append(
419-
"Error Chunk {}: {}".format(str(count), res.get("message"))
421+
"Error Chunk {}: {}".format(str(count), json_res.get("message"))
420422
)
421-
results["other"].append(res.get("transactional_errors"))
423+
results["other"].append(json_res.get("transactional_errors"))
422424

423425
elif "code" not in json_res:
424426
print("\t Unhandled API-response: {}".format(response))

0 commit comments

Comments
 (0)