refix test + switch apis to https
This commit is contained in:
parent
0eb069c86a
commit
8e30ac7400
@ -74,7 +74,7 @@ def _get_request(url, headers=None):
|
|||||||
def doi2bibtex(doi, **kwargs):
|
def doi2bibtex(doi, **kwargs):
|
||||||
"""Return a bibtex string of metadata from a DOI"""
|
"""Return a bibtex string of metadata from a DOI"""
|
||||||
|
|
||||||
url = 'http://dx.doi.org/{}'.format(doi)
|
url = 'https://dx.doi.org/{}'.format(doi)
|
||||||
headers = {'accept': 'application/x-bibtex'}
|
headers = {'accept': 'application/x-bibtex'}
|
||||||
r = _get_request(url, headers=headers)
|
r = _get_request(url, headers=headers)
|
||||||
if r.encoding is None:
|
if r.encoding is None:
|
||||||
@ -89,7 +89,7 @@ def doi2bibtex(doi, **kwargs):
|
|||||||
def isbn2bibtex(isbn, **kwargs):
|
def isbn2bibtex(isbn, **kwargs):
|
||||||
"""Return a bibtex string of metadata from an ISBN"""
|
"""Return a bibtex string of metadata from an ISBN"""
|
||||||
|
|
||||||
url = 'http://www.ottobib.com/isbn/{}/bibtex'.format(isbn)
|
url = 'https://www.ottobib.com/isbn/{}/bibtex'.format(isbn)
|
||||||
r = _get_request(url)
|
r = _get_request(url)
|
||||||
soup = BeautifulSoup(r.text, "html.parser")
|
soup = BeautifulSoup(r.text, "html.parser")
|
||||||
citation = soup.find("textarea").text
|
citation = soup.find("textarea").text
|
||||||
|
@ -84,12 +84,12 @@ elif mode == 'COLLECT':
|
|||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
error_msg = str(e)
|
error_msg = str(e)
|
||||||
|
|
||||||
|
text = intercept_text(text)
|
||||||
_collected_responses.append((args, kwargs, text, status_code, error_msg))
|
_collected_responses.append((args, kwargs, text, status_code, error_msg))
|
||||||
_save_collected_responses() # yes, we save everytime, because it's not
|
_save_collected_responses() # yes, we save everytime, because it's not
|
||||||
# clear how to run once after all the tests
|
# clear how to run once after all the tests
|
||||||
# have run. If you figure it out...
|
# have run. If you figure it out...
|
||||||
|
|
||||||
text = intercept_text(text)
|
|
||||||
return MockingResponse(text, status_code, error_msg)
|
return MockingResponse(text, status_code, error_msg)
|
||||||
|
|
||||||
def _save_collected_responses():
|
def _save_collected_responses():
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user