-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add function to download PDF from Wiley author manuscript service * Add corresponding unit test and fixtures * https://mitlibraries.atlassian.net/browse/DLSPP-30
- Loading branch information
Showing
8 changed files
with
43 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,4 +132,5 @@ dmypy.json | |
*.xlsx | ||
.DS_Store | ||
!tests/fixtures/test.csv | ||
!tests/fixtures/*.csv | ||
!tests/fixtures/*.pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import requests | ||
|
||
headers = { | ||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " | ||
"(KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36" | ||
} | ||
|
||
|
||
def get_wiley_pdf(url, doi): | ||
"""Get PDF from Wiley server based on a DOI.""" | ||
return requests.get(f"{url}{doi}", headers=headers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from awd import wiley | ||
|
||
|
||
def test_get_wiley_pdf(web_mock, wiley_pdf): | ||
doi = "10.1002/term.3131" | ||
response = wiley.get_wiley_pdf("http://example.com/doi/", doi) | ||
assert response.content == wiley_pdf |