{"id":18425712,"url":"https://github.com/dwayne/playwhe","last_synced_at":"2026-03-19T04:20:17.826Z","repository":{"id":1556750,"uuid":"1952724","full_name":"dwayne/playwhe","owner":"dwayne","description":"A Python library and CLI for fetching and storing Play Whe results.","archived":false,"fork":false,"pushed_at":"2022-12-26T20:53:56.000Z","size":521,"stargazers_count":1,"open_issues_count":11,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-11T00:52:38.195Z","etag":null,"topics":["nlcb","playwhe"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/playwhe/","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dwayne.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-06-25T16:37:40.000Z","updated_at":"2022-02-06T00:47:05.000Z","dependencies_parsed_at":"2023-01-11T16:04:36.668Z","dependency_job_id":null,"html_url":"https://github.com/dwayne/playwhe","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/dwayne/playwhe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwayne%2Fplaywhe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwayne%2Fplaywhe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwayne%2Fplaywhe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwayne%2Fplaywhe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dwayne","download_url":"https://codeload.github.com/dwayne/playwhe/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwayne%2Fplaywhe/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28698893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T17:25:48.045Z","status":"ssl_error","status_checked_at":"2026-01-23T17:25:47.153Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nlcb","playwhe"],"created_at":"2024-11-06T05:05:00.137Z","updated_at":"2026-01-23T19:33:03.852Z","avatar_url":"https://github.com/dwayne.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"playwhe\n=======\n\nA Python library and CLI for fetching and storing Play Whe results from the\n`National Lotteries Control Board \u003chttp://www.nlcb.co.tt/\u003e`_ (NLCB).\n\nI originally wrote :code:`playwhe` in 2011 when I wanted to work on a small\nproject to build a RESTful API for Play Whe. The project has grown since then\nand this code continues to play a key role in it.\n\n:code:`playwhe` helps many people to conveniently access Play Whe results.\n\nInstallation\n------------\n\nTo install, simply use pip (or `pipenv`_):\n\n.. code-block:: bash\n\n    $ pip install playwhe\n\n.. _pipenv: https://github.com/pypa/pipenv\n\nUsage\n-----\n\nThe library supports the implementation of the CLI. In the future, a developer\nwould also be able to use the library within another application to query a\ndatabase of Play Whe results in useful and interesting ways.\n\n**So what can the CLI do?**\n\nThere are 3 main things you can do with :code:`playwhe` on the command-line:\n\n1. Initialize a database for storing Play Whe results.\n2. Load existing Play Whe results from a CSV file into the database.\n3. Update the database with the latest results from NLCB's servers.\n\n**Initialize**\n\nTo initialize a database for storing Play Whe results you need to run the\nfollowing:\n\n.. code-block:: bash\n\n    $ playwhe --verbose --init sqlite:///$HOME/playwhe.db\n\nThe command creates a new SQLite database in the :code:`playwhe.db` file in the\n:code:`$HOME` directory. The database contains the tables needed for storing the\nPlay Whe results.\n\nOnce the database has been initialized you can begin to load or update the Play\nWhe results as needed.\n\n**Load**\n\nTo load Play Whe results from a CSV file into the database you need to run the\nfollowing:\n\n.. code-block:: bash\n\n    $ playwhe --verbose --load data/results.csv sqlite:///$HOME/playwhe.db\n\n:code:`results.csv` is a CSV file that contains the results you intend to load\ninto the database.\n\nEach line in the CSV file needs to be in the format:\n\n.. code-block::\n\n    \u003cdraw:1|2|3|...\u003e,\u003cdate:yyyy-mm-dd\u003e,\u003cperiod:EM|AM|AN|PM\u003e,\u003cnumber:1-36\u003e\n\nThe load command is intended to be used, only once, when you're starting off\nwith an empty database, i.e. when you've just initialized the database. In fact,\nyou can initialize and load the database in one command by running the\nfollowing:\n\n.. code-block:: bash\n\n    $ playwhe -Vil data/results.csv sqlite:///$HOME/playwhe.db\n\n:code:`-V` is shorthand for :code:`--verbose`, :code:`-i` is shorthand for\n:code:`--init` and :code:`-l` is shorthand for :code:`--load`.\n\nYou can find a necessarily out-of-date :code:`results.csv` file in the\n:code:`data` directory of this project. I update it occasionally so that you\ndon't have to do too much updating when you're starting from an empty database.\n\nAnother benefit of using :code:`data/results.csv` is that if there's any error\nin the results provided by NLCB then I usually fix it in the CSV file. So at\nleast you know you're starting off with good data.\n\n**Update**\n\nTo update the database with the latest results from NLCB's servers you need to\nrun the following:\n\n.. code-block:: bash\n\n    $ playwhe --verbose --update sqlite:///$HOME/playwhe.db\n\nIf you're starting from an empty database or a really out-of-date database then\nbe prepared to wait a while since the program has to fetch the data from a\nremote server.\n\nThe :code:`--verbose` option is not necessary but it's helpful. Use it to keep\ntrack of the task when you're running it interactively.\n\nIf you intend to update using a cron job then I'd recommend removing the\n:code:`verbose` flag and also redirecting standard error to a log file. Here's\nwhat the command would look like:\n\n.. code-block:: bash\n\n    $ playwhe --update sqlite:///$HOME/playwhe.db 2\u003e\u003e $HOME/playwhe.log\n\n**What else can the CLI do?**\n\nNot much else at the moment but you can always access help to get a refresher\non how to perform a certain task:\n\n.. code-block:: bash\n\n    $ playwhe --help\n\nDevelopment\n-----------\n\nRecommended tools:\n\n - `pyenv \u003chttps://github.com/pyenv/pyenv\u003e`_\n - `pipenv`_\n\nClone the repository and install the dependencies:\n\n.. code-block:: bash\n\n    $ git clone git@github.com:playwhesmarter/playwhe.git\n    $ cd playwhe\n    $ pipenv shell\n    $ pipenv install --dev\n\nYou're now all set to begin development.\n\nTesting\n-------\n\nTests are written using the built-in unit testing framework, `unittest \u003chttps://docs.python.org/3/library/unittest.html\u003e`_.\n\nRun all tests.\n\n.. code-block:: bash\n\n    $ python -m unittest\n\nRun a specific test module.\n\n.. code-block:: bash\n\n    $ python -m unittest tests.playwhe.client.test_fetcher\n\nRun a specific test case.\n\n.. code-block:: bash\n\n    $ python -m unittest tests.playwhe.client.test_fetcher.FetchFromMockServerTestCase.test_when_it_succeeds\n\nRun a test against the real server.\n\n.. code-block:: bash\n\n    $ PLAYWHE_TESTS_USE_REAL_SERVER=1 python -m unittest tests.playwhe.client.test_fetcher.FetchFromRealServerTestCase\n\nResources\n---------\n\n- `NLCB \u003chttp://www.nlcb.co.tt/\u003e`_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdwayne%2Fplaywhe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdwayne%2Fplaywhe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdwayne%2Fplaywhe/lists"}