Package: nmfishingreport
NM Fishing Reportmaster:Scrapes the NM Dept of Game and Fish fishing reportFree software: MITDocumentation:https://nmfishingreport.readthedocs.orgFeaturesScrapes fishing report into sqlite databaseWrites to a text file the reports for a specified list of spotsBasic Markdown formatI use this to output to a Dropbox folder for easy access on mobileMonitors for keywords and can optionally use a custom notification script
when those keywords appear in a reportIntroductionThe NM Dept of Game and Fish publishesa biweekly fishing
report. This script
scrapes the report into a database so I can see how various spots fare
throughout the year. It send me aPushovernotification whenever the report for one of my favorite spots has any of the
buzzwords I've selected.DependenciesPython3OS X or LinuxSeerequirements.txtQuickstartCopyconfig-sample.ini(recommended: rename toconfig.ini, which is.gitignored)Modify config (see section below)pip3 install nmfishingreportpython3 -m nmfishingreport -c /path/to/your-config.iniDevelopment SetupClone the repo:git clone https://github.com/n8henrie/nmfishingreport && cd nmfishingreportMake a virtualenv:python3 -m venv .venvInstall dev setup:./.venv/bin/pip install .[dev]ConfigurationI recommend you start withconfig-sample.ini. I've tried to add comments to
make it somewhat self-explanatory. A few notes:You'll need to make sure your spelling matches NMDGF forfav_spots.I've included my database file with some reports going back to 2015There are likely several holes from times when the NMDGF updated their
website and broke the script or times that my computer wasn't runningIf you want to want to continue with my existing database, copy it to a
more reasonable filename (recommended:fishing_reports.db), and use it
asdbin your configThe filenamefishing_reports.dbis.gitignore-dI'll try to update the provided file from time to timeNotification configIf you know a bit of Python, you can optionally provide a notification script
if you want to get a push notification (or email or what have you) when certain
keywords show up in the report for one of yourfav_spots. The file should
expose a bare functionnotifythat accepts two arguemnts:A dictionary containing the following keys:spot: the fishing spot triggering the notificationreport: the text of that spot's fishing reporturl: the URL for the fishing reportThe path to your config fileBecause it accepts a path to your config file, you can add a section to your
config file to include usernames and passwords for the notification script if
needed. For example, in theextras/directory I've included my (working)notify.pyfor Pushover -- it pulls my Pushover credentials from my config
file, which is kept out of version control.Be forewarned thatnmfishingreportloads the notification script toexecing
its contents, which I'm sure could have security ramifications or lead to data
loss if you aren't careful. Leave theNOTIFYsection out of your config to
avoid this entirely.AcknowledgementsNM Dept of Game and Fish!Troubleshooting / FAQ / ExamplesHow can I get info out of an sqlite database?I'm not terribly good at sqlite either, so here's how to convert it to a
csv file that you can open in your spreadsheet app of choice:sqlite3 -header -csv fishing_reports.db "SELECT * FROM nm_fishing_reports;" > fishingreport.csvSome other ideas on looking at the contents:Dump all reports to your screen:sqlite3 fishing_reports.db 'SELECT * FROM nm_fishing_reports;'Show the 10 most recent reports:sqlite3 fishing_reports.db 'SELECT * FROM nm_fishing_reports ORDER BY date DESC LIMIT 10;'Show the 5 most recent reports for the Jemez waters:sqlite3 fishing_reports.db 'SELECT date, report FROM nm_fishing_reports WHERE spot LIKE "%Jemez%" ORDER BY date DESC LIMIT 5;'Show the most recent spot to have had the word "excellent" in the report:sqlite3 fishing_reports.db 'SELECT date, spot FROM nm_fishing_reports WHERE report LIKE "% excellent %" ORDER BY date DESC LIMIT 1;'Show what times of year the Jemez fishing has been "very good" or
"excellent":sqlite3 fishing_reports.db 'SELECT date FROM nm_fishing_reports WHERE (report LIKE "% very good %" OR report LIKE "% excellent %") AND spot LIKE "%Jemez%";'How can I runnmfishingreportautomatically?If you're on OS X, I've included an example launchd plist inextras/