-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import archive.org bulk marc items #1058
Changes from 1 commit
4050d5c
0236ecd
5cfb8f0
17f45e5
68e36fb
f28a84a
3e417e1
729a321
5872309
0f34ee1
c8bb135
add6383
b6f5174
5e83d32
cb25df8
0dd5770
6b85403
3bb8884
23b8ec5
3e4e271
f968ba5
972f793
647cb54
cb88426
3035437
0c75981
0383d86
82d7e5f
26326ca
1bf18cf
0292910
1792e9b
51baf2e
c81e186
54e2cc6
09b6817
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
from openlibrary.catalog.marc.marc_binary import MarcBinary | ||
from openlibrary.catalog.marc.marc_xml import MarcXml | ||
from openlibrary.catalog.marc import parse | ||
from infogami import config, load_config | ||
from lxml import etree | ||
import xml.parsers.expat | ||
import urllib2, os.path, socket | ||
from time import sleep | ||
import traceback | ||
from openlibrary.core import ia | ||
|
||
IA_BASE_URL = 'https://archive.org' | ||
load_config('conf/openlibrary.yml') | ||
IA_BASE_URL = config.get('ia_base_url') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
IA_DOWNLOAD_URL = '%s/download/' % IA_BASE_URL | ||
hornc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
MAX_MARC_LENGTH = 100000 | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,10 +84,11 @@ def test_urlsafe(): | |
assert h.urlsafe("a?") == "a" | ||
|
||
def test_get_coverstore_url(monkeypatch): | ||
assert h.get_coverstore_url() == "https://covers.openlibrary.org" | ||
|
||
from infogami import config | ||
|
||
monkeypatch.delattr(config, "coverstore_url", raising=False) | ||
assert h.get_coverstore_url() == "https://covers.openlibrary.org" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like another good opportunity to move canonical covers service address into a config There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test is testing that the fallback (in the absence of config or config file) cover url is As policy, should we hardcode defaults, or simply reply on config? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should rely on config (defaults). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be a separate issue, merging for now |
||
|
||
monkeypatch.setattr(config, "coverstore_url", "https://0.0.0.0:8090", raising=False) | ||
assert h.get_coverstore_url() == "https://0.0.0.0:8090" | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mekarpeles I'm not completely happy about this line,
openlibrary/plugins/importapi/code.py
already has config available viaconfig.get()
, butopenlibrary/catalog/get_ia.py
does not 🤷♂️ I don't understand the purpose of https://github.com/internetarchive/openlibrary/blob/master/openlibrary/config.py either, it looks like a confusingly named / name collision version ofinfogami.config
. This seems to work, but I'm not sure I fully understand how config is meant to be shared, or passed around parts of OL.