Skip to content

Commit

Permalink
Merge pull request #127 from sul-dlss/refactor-remediate
Browse files Browse the repository at this point in the history
Uses correct okapi_headers properties
  • Loading branch information
shelleydoljack committed Aug 9, 2022
2 parents 0944783 + fd8cd81 commit 0f2ab7b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions plugins/folio/remediate.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ def _post_or_put_record(record: dict, endpoint: str, folio_client: FolioClient):
post_url = f"{folio_client.okapi_url}{endpoint}"

# Tries a PUT request for existing record
put_result = requests.put(put_url, headers=folio_client.headers, json=record)
put_result = requests.put(put_url, headers=folio_client.okapi_headers, json=record)
if put_result.status_code < 300:
logging.info(f"Updated {record['id']} to {folio_client.okapi_url}")
elif put_result.status_code == 404:
# Record not found in FOLIO, try creating with POST
post_result = requests.post(post_url, headers=folio_client.headers, json=record)
post_result = requests.post(post_url, headers=folio_client.okapi_headers, json=record)
if post_result.status_code < 300:
logging.info(f"Added {record['id']} to {folio_client.okapi_url}")
else:
Expand Down
2 changes: 1 addition & 1 deletion plugins/tests/test_remediate.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class MockFolioClient(pydantic.BaseModel):
password = "abdccde"
username = "folio_admin"
folio_get = mock_folio_get
headers = {}
okapi_headers = {}


@pytest.fixture
Expand Down

0 comments on commit 0f2ab7b

Please sign in to comment.