diff --git a/src/zbmath_rest2oai/get_all_de.py b/src/zbmath_rest2oai/get_all_de.py index b540fcb..e2612e0 100644 --- a/src/zbmath_rest2oai/get_all_de.py +++ b/src/zbmath_rest2oai/get_all_de.py @@ -8,13 +8,13 @@ # from https://stackoverflow.com/a/38677619/9215209 -def get_all_de(api_source, csv_url): +def get_all_de(api_source, csv_url, prefix): with requests.get(csv_url, stream=True) as r: lines = (line.decode('utf-8') for line in r.iter_lines()) for row in csv.reader(lines): de = row[0] try: - write_oai(de, api_source) + write_oai(de, api_source, prefix) except Exception as error: print(de, error, file=sys.stderr) diff --git a/src/zbmath_rest2oai/run_get_all_de_documents.py b/src/zbmath_rest2oai/run_get_all_de_documents.py index bdba05e..2d46f07 100644 --- a/src/zbmath_rest2oai/run_get_all_de_documents.py +++ b/src/zbmath_rest2oai/run_get_all_de_documents.py @@ -3,4 +3,4 @@ CSV_URL = 'https://github.com/MaRDI4NFDI/python-zbMathRest2Oai/releases/download/test/all_de_240115.csv' if __name__ == '__main__': - get_all_de('https://api.zbmath.org/v1/document/',CSV_URL) \ No newline at end of file + get_all_de('https://api.zbmath.org/v1/document/',CSV_URL, 'oai:zbmath.org:') \ No newline at end of file diff --git a/src/zbmath_rest2oai/run_get_all_de_software.py b/src/zbmath_rest2oai/run_get_all_de_software.py index cfd1846..41a86df 100644 --- a/src/zbmath_rest2oai/run_get_all_de_software.py +++ b/src/zbmath_rest2oai/run_get_all_de_software.py @@ -2,4 +2,4 @@ CSV_URL = 'https://raw.githubusercontent.com/MaRDI4NFDI/python-zbMathRest2Oai/main/src/zbmath_rest2oai/software.csv' if __name__ == '__main__': - get_all_de('https://api.zbmath.org/v1/software/_search?search_string=si%3A',CSV_URL) \ No newline at end of file + get_all_de('https://api.zbmath.org/v1/software/_search?search_string=si%3A',CSV_URL, 'oai:swmath.org:') \ No newline at end of file diff --git a/src/zbmath_rest2oai/writeOai.py b/src/zbmath_rest2oai/writeOai.py index 3d8b572..9032f0c 100644 --- a/src/zbmath_rest2oai/writeOai.py +++ b/src/zbmath_rest2oai/writeOai.py @@ -8,10 +8,7 @@ from zbmath_rest2oai import getAsXml -def write_oai(x, api_source): - prefix='oai:zbmath.org:' - if 'software' in api_source: - prefix='oai:swmath.org:' +def write_oai(x, api_source, prefix): test_xml = getAsXml.final_xml2(x, api_source) files = { "item": ( @@ -38,4 +35,4 @@ def write_oai(x, api_source): if __name__ == '__main__': import sys - write_oai(sys.argv[1], sys.argv[2]) + write_oai(sys.argv[1], sys.argv[2], sys.argv[3])