Package: pylunch
PylunchPyLunchwas designed to scrape restaurants for it's daily menus and show them in multiple ways and formats.Getting statedPyLunchis a scraper, to use it, you have to install it. It is available atPyLunchInstall the released versionYou can install thePyLunchusing thepip:$pipinstallpylunchInstall the development version from githubPython 3.7 or later(Optional)pipenvOr you can add it as a development dependency using thepipenv$gitclonehttps://github.com/pestanko/pylunch.git
$cdpylunch
$pipenvinstall# install the dependenciesInstall Tesseract for OCR supportTo support extracting text from images you need to installTesseract.
Then you need to download trained models for your languageTesseract data files wiki(English is supported by default).Recommended are thebest (most accurate) trained models.
Save downloaded trained models to a dictionary with nametessdata.
Expose environment variableTESSDATA_PREFIXwith path totessdatadirectory (i.e.TESSDATA_PREFIX=/tmp/tessdata).You can specify different language when extracting data from the image for any restaurant with attributelanguage: <Lang code>inrestaurants.ymlfile.Dockerfile supported languages:LanguageLang codeEnglishengCzechcesSlovakslkFirst RunIn order to run the tool correctly you need to configure it.At first run the tool will create config folder in the home directory with restaurants database,
by default it will be empty.To use thezomatoresolver you need to add thezomato_keyto your configuration.
In order to get the zomato key you need to go to theZomato Api documentation$pylunchcfg-setzomato_key"<YOUR_KEY>"To use the telegram integration, you need to set the telegram bot token propertytelegram_token.
To get the telegram bot token please take a lookhere.$pylunchcfg-settelegram_token"<YOUR_KEY>"To use the discord integration, you need to set the discord bot token propertydiscord_token.
For more information how to get them you gohere.$pylunchcfg-setdiscord_token"<YOUR_KEY>"Also if you have already created or exported database of the restaurants, you an import it using the commandimport:
Example file is located in:resources/restaurants.ymlavailablehere.$pylunchimport-Orestaurants.ymlIf you wish to load example from the repository you can use thecurland just pipe it to theimportsubcommand.$curl'https://gitlab.com/pestanko/pylunch/raw/master/resources/restaurants.yml'|pylunchimport-OIn order to export the restaurants database file, you can use the export command.$pylunchexport-fexported.ymlRun the cli toolHera is a help output with available commands.# Show the help$pylunch--help

Usage:pylunch[OPTIONS]COMMAND[ARGS]...PyLunchCLItool

Options:--versionShowtheversionandexit.-L,--log-levelTEXTSetloglevel(d|i|w|e)-default=w-C,--no-cacheDisablecache-c,--config-dirTEXTLocationtotheconfigurationdirectory-F,--formatTEXTSetoutputformat--helpShowthismessageandexit.

Commands:addAddsanewrestaurantcache-clearClearacurrentcacheforadaycache-contentShowthecurrentcacheforadaycfg-editEditaconfigurationusingtheeditor(Ex:VIM)cfg-setSetaconfigvalueintheuserconfigurationconfigShowsthecurrentconfigurationconsoleStarttheinteractiveconsole(IPython)disableDisablestherestaurantseditEditsrestaurantsDBfileenableEnablestherestaurantsexportExportrestaurantsimportImportrestaurantsinfoGetinfofortherestaurantlsListallavailablerestaurantsmenuGetmenuforarestaurantrmRemovestherestauranttelegram-botStartthetelegrambotRunnig the serverAs a server is used the Flask.
To run the flask server please take a look to the documnetation.In order to start the pylunch server take a look at therun_flask.ps1orrun_flask.shscripts.For access to the admin pages - in order to import restaurants or invalidate (refresh cache) you will need to set env variables:PYLUNCH_SECRET=<JWT_SECRET>
PYLUNCH_USERS=PATH_TO_USERS_FILEAdmin user credentials:Username: admin
Password: foobar1