{ "info": { "author": "Patrik Purgai", "author_email": "purgai.patrik@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Python API for the Hungarian Cinema City\n\nThis framework provides a Python interface for the Cinema City data API. Events at a specific time and location can be querried from the API by calling `fetch_events([dates], [locations])`. The data from the query is stored as an iterable of nested DTOs, which are the following. **`Cinema`** object with `id` *( `str`, the unique identifier of a venue. )* and `name` *( `str`, the name of a venue. )* attributes. **`Movie`** object with `id` *( `str`, the unique identifier of a movie. )*, `name` *( `str`, the name of a venue. )*, `attributes` *( `tuple`, movie specific information like dubbing or 3D. )* and `length` *( `int`, length of the movie in minutes. )*. **`Event`** object with `id` *( `str`, the unique identifier of an event. )*, `date` *( `datetime`, begining time of the movie screening. )*, `booking_link` *( `str`, url of the ticket booking link. )*, `sold_out` *( `bool`, availability of tickets. )*, `movie` *( `Movie`, the screened movie, stored as a `Movie` object. )*, `cinema` *( `Cinema`, the location of the event, stored as a `Cinema` object. )* and `attributes` *( `tuple`, movie specific information like dubbing or 3D. )*.\n\n## Usage\n\nInstalling the package is straightforward with pip directly from this git repository or from pypi with either of the following commands.\n\n```bash\npip install git+https://github.com/Mrpatekful/pycin\n```\n\n```bash\npip install pycin\n```\n\nAltough the package contains all of the existing cinema location as Cinema DTO constants, this information may be outdated. The `fetch_cinemas` method always returns up-to-date cinema data.\n\n```python\nfrom pycin import fetch_cinemas\n\ncinemas = fetch_cinemas()\n\nprint(cinemas)\n```\n\n```text\n[Cinema(id='1124', name='Alba - Sz\u00e9kesfeh\u00e9rv\u00e1r'), Cinema(id='1133', name='Allee - Budapest'), Cinema(id='1132', name='Ar\u00e9na - Budapest'), Cinema(id='1131', name='Balaton - Veszpr\u00e9m'), Cinema(id='1139', name='Campona - Budapest'), Cinema(id='1127', name='Debrecen'), Cinema(id='1141', name='Duna Pl\u00e1za - Budapest'), Cinema(id='1125', name='Gy\u0151r'), Cinema(id='1129', name='Miskolc'), Cinema(id='1143', name='Ny\u00edregyh\u00e1za'), Cinema(id='1128', name='P\u00e9cs'), Cinema(id='1134', name='Savaria - Szombathely'), Cinema(id='1136', name='Sopron'), Cinema(id='1126', name='Szeged'), Cinema(id='1130', name='Szolnok'), Cinema(id='1137', name='Westend - Budapest'), Cinema(id='1135', name='Zalaegerszeg')]\n```\n\nFetching events in cinema *Alle*, *Westend*, where the screened movie has the id *3196o2r*.\n\n```python\nfrom datetime import datetime\nfrom pycin import fetch_events, ALLE, WESTEND\n\nquery = fetch_events([datetime.today()], [ALLE, WESTEND])\n\nresult = list(\n query.filter(lambda e: e.movie.id == '3196o2r')\n .select(lambda e: (e.date, e.cinema.name))\n)\n\nprint(result)\n```\n\n```text\n[(datetime.datetime(2019, 2, 28, 17, 40), 'Allee - Budapest'), (datetime.datetime(2019, 2, 28, 19, 50), 'Allee - Budapest'), (datetime.datetime(2019, 2, 28, 22, 0), 'Allee - Budapest'), (datetime.datetime(2019, 2, 28, 17, 20), 'Alba - Sz\u00e9kesfeh\u00e9rv\u00e1r'), (datetime.datetime(2019, 2, 28, 19, 30), 'Alba - Sz\u00e9kesfeh\u00e9rv\u00e1r')]\n```\n\nFinding the unique set of movies, which are played after 8:00 PM on the next week at any Cinema City in Budapest (because default location for `fetch_events` is `BUDAPEST_CINEMAS`).\n\n```python\nfrom pycin import fetch_events\nfrom datetime import datetime, timedelta\n\nnext_week = [datetime.today() + timedelta(d) for d in range(7)]\n\nquery = fetch_events(next_week)\n\nresult = set(\n query.filter(lambda e: e.date.hour > 20)\n .select(lambda e: e.movie.name)\n)\n\nprint(result)\n```\n\n```text\n{'K\u00f6lcs\u00f6nlak\u00e1s', 'Cold Pursuit', 'Happy DeathDay 2U', 'Instant Family', 'Heavy Trip (Hevi Reissu)', 'Sink or Swim (Le grand bain)', 'Alita: Battle Angel', 'Most van most', 'En Libert\u00e9 (The Trouble with You)', 'Bohemian Rhapsody', 'Vice', 'Apr\u00f3 mes\u00e9k', 'Green Book', 'Drunk Parents', 'The Prodigy', 'Captain Marvel', 'Glass', 'Fighting with My Family'}\n```\n\nThe `search_events` may take longer to execute on the first call, but the results are cached, thus making subsequent calls yield results instantaneously.\n\n```python\nimport logging\nfrom datetime import datetime\nfrom pycin import fetch_events\n\n# Setting up logging to the console.\nconsole = logging.StreamHandler()\nformatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')\nconsole.setFormatter(formatter)\nlogger.addHandler(console)\n\ndef list_dates(dates, cinemas):\n \"\"\"Finds screening dates of 2d movies with the\n word `marvel` in their title.\"\"\"\n query = fetch_events(dates, cinemas)\n\n return list(\n query.filter(lambda e: '2d' in e.attributes and \\\n 'marvel' in e.movie.name.lower())\n .select(lambda e: datetime.strftime(e.date, '%H:%M'))\n )\n\nlist_dates([datetime.today()], [ALLE])\n# second call is instantaneous because of cached results\nresult = list_dates([datetime.today()], [ALLE])\n\nprint(result)\n```\n\n```text\n2019-03-12 11:38:16,454 - DEBUG - Query finished in 0.9281s.\n2019-03-12 11:38:16,466 - DEBUG - Query finished in 0.0000s.\n['13:20', '16:00', '16:50', '18:40', '19:30', '21:20', '22:10']\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Mrpatekful/pycin", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pycin", "package_url": "https://pypi.org/project/pycin/", "platform": "", "project_url": "https://pypi.org/project/pycin/", "project_urls": { "Homepage": "https://github.com/Mrpatekful/pycin" }, "release_url": "https://pypi.org/project/pycin/0.1.0/", "requires_dist": null, "requires_python": "", "summary": "Python interface for the Hungarian Cinema City API.", "version": "0.1.0" }, "last_serial": 5349005, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "48d1d8dcb28589994d870a586c028466", "sha256": "39930675adbb0ba2c6e6529215e251080d563f34f91d02a12d2d18b08e12f1c0" }, "downloads": -1, "filename": "pycin-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "48d1d8dcb28589994d870a586c028466", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7502, "upload_time": "2019-06-02T14:50:47", "url": "https://files.pythonhosted.org/packages/2b/54/8187eb770f03f9ce4fabf9be715055039bae70783181a0a6f5d883e7c40b/pycin-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e1a2791f2006b2aa29616b0ae5435ddd", "sha256": "e6b2b0e5d986ed732c0c1c1a688fcb24f8f5a67856be9e22cd3cf06832371ac8" }, "downloads": -1, "filename": "pycin-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e1a2791f2006b2aa29616b0ae5435ddd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6057, "upload_time": "2019-06-02T14:50:50", "url": "https://files.pythonhosted.org/packages/32/77/e8633c3d9eadf09987ef373b8b953b1584617e2ca2aad87d98567425280f/pycin-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "48d1d8dcb28589994d870a586c028466", "sha256": "39930675adbb0ba2c6e6529215e251080d563f34f91d02a12d2d18b08e12f1c0" }, "downloads": -1, "filename": "pycin-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "48d1d8dcb28589994d870a586c028466", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7502, "upload_time": "2019-06-02T14:50:47", "url": "https://files.pythonhosted.org/packages/2b/54/8187eb770f03f9ce4fabf9be715055039bae70783181a0a6f5d883e7c40b/pycin-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e1a2791f2006b2aa29616b0ae5435ddd", "sha256": "e6b2b0e5d986ed732c0c1c1a688fcb24f8f5a67856be9e22cd3cf06832371ac8" }, "downloads": -1, "filename": "pycin-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e1a2791f2006b2aa29616b0ae5435ddd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6057, "upload_time": "2019-06-02T14:50:50", "url": "https://files.pythonhosted.org/packages/32/77/e8633c3d9eadf09987ef373b8b953b1584617e2ca2aad87d98567425280f/pycin-0.1.0.tar.gz" } ] }