fixed lahman.py; added test_lahman.py#449
Conversation
|
there is also a fix here #434 |
|
I meant this PR #435 |
|
Respectfully, I don't know of any reason why not to use 7zip/py7z. Now, the justification to use it is that it is the compression format Sean Lahman has chosen. Furthermore, to that extent, I don't think it is appropriate to rely upon a third-party to host a zip file. (Same goes for putting the zip file into this repository). I would rather go directly to the source, i.e., seanlahman.com - that way when he updates the data this library can download the latest without delay. Can discuss more here or on Discord. Thanks. |
| soup = BeautifulSoup(response.content, "html.parser") | ||
|
|
||
| anchor = soup.find("a", string="Comma-delimited version") | ||
| url = anchor["href"].replace("dl=0", "dl=1") |
There was a problem hiding this comment.
@mlinenweber Can you explain these 2 lines and what _get_download_url() is supposed to return?
anchor = soup.find("a", string="Comma-delimited version")
url = anchor["href"].replace("dl=0", "dl=1")I get the below error when trying to run people()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[24], line 31
28 soup = BeautifulSoup(response.content, "html.parser")
30 anchor = soup.find("a", string="Comma-delimited version")
---> 31 url = anchor["href"].replace("dl=0", "dl=1")
TypeError: 'NoneType' object is not subscriptableIs soup.find("a", string="Comma-delimited version") supposed to be None?
lahman.py- now downloads from dropbox [does so in a generic way, by finding the link in http://seanlahman.com]test_lahman.pyconftest.py, by combiningresponse_get_monkeypatchandbref_get_monkeypatchto usetarget_get_monkeypatch[they differed by only 1 line].get_data_file_bytesandtarget.setup.pyto installpy7zrandrequests_cachefixes #391