thisisparker / xword-dl

⬛⬜⬛ Command line tool to scrape crosswords from online solvers and save them as .puz files ⬛⬜⬛
MIT License
146 stars 31 forks source link

wsj, base: Move requests to a session object that can accept settings #183

Closed thisisparker closed 8 months ago

thisisparker commented 8 months ago

This change creates a requests Session object at the BaseDownloader level and loads it with the headers and cookies that are specified in a config file, as keyword arguments, or command line arguments. In part this keeps us from having to repeat ourselves in instances where we have multiple requests that require the same arguments, and it should slightly simplify the story for new downloaders.

All the old-style downloaders will continue to work, but should eventually be updated to use the Session established by the BaseDownloader. For this PR, I've updated the WSJ downloader to the new syntax in order to put together a fix for #178. I've also attempted to update the tests that it uses... we'll see!