We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dbd7297 commit 75d828cCopy full SHA for 75d828c
2 files changed
metadata_fetcher/fetchers/marc_fetcher.py
@@ -0,0 +1,23 @@
1
+import requests
2
+
3
+from .Fetcher import Fetcher
4
+import json
5
+import pymarc
6
7
8
+class MarcFetcher(Fetcher):
9
+ def __init__(self, params: dict[str]):
10
+ super(MarcFetcher, self).__init__(params)
11
+ self.url = params.get("harvest_data").get("url")
12
13
+ def build_fetch_request(self) -> dict[str]:
14
+ return {"url": self.url}
15
16
+ def check_page(self, http_resp: requests.Response) -> int:
17
+ return sum(1 for _ in pymarc.MARCReader(http_resp.content,
18
+ to_unicode=True,
19
+ utf8_handling="replace"))
20
21
+ def json(self) -> str:
22
+ return json.dumps({"finished": True})
23
metadata_fetcher/requirements.txt
@@ -3,3 +3,4 @@ requests
sickle
python-dotenv
beautifulsoup4
+pymarc
0 commit comments