{ "info": { "author": "Daniel Michaels", "author_email": "dans.address@outlook.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "```\n ______ __ __ __ \n / ____/_ _____ / / ______ _/ /______/ /_ ___ _____\n / /_ / / / / _ \\/ / | /| / / __ `/ __/ ___/ __ \\/ _ \\/ ___/\n / __/ / /_/ / __/ /| |/ |/ / /_/ / /_/ /__/ / / / __/ / \n/_/ \\__,_/\\___/_/ |__/|__/\\__,_/\\__/\\___/_/ /_/\\___/_/ v 0.2.0\n```\n\n# Fuelwatcher\n\nA simple python module that scrapes XML data from the government of Western Australia's FuelWatch initiative website making parsing a breeze.\n\n>Fuelwatch.wa.gov.au provides information on fuel prices by fuel type, location, brand and region within Western Australia. \n> Fuelwatcher will parse the XML from the fuelwatch.wa.gov.au RSS feed giving the developer an easy way to manipulate the information.\n\n## Installation\n\nRequires `pip` to be installed or `pip3` dependant on system, or environment. \n\n**Python 3 only**\n\n```sh\npip install fuelwatcher\n```\n\n## Usage example\n\n### Basic Usage\n\n```python\nfrom fuelwatch import FuelWatch\n\napi = FuelWatch()\n\napi.query(product=2, region=25, day='yesterday')\n# returns byte string of xml.\nxml_query = api.get_xml\n# iterates over each fuel station entry in the byte string\n# and returns list of dictionaries in human readable text.\n\nprint(parsed_query)\n\n>>>> [{'title': '138.5: Puma Bayswater', 'description': 'Address: 502 Guildford Rd, BAYSWATER, Phone: (08) 9379 1322, Open 24 hours', 'brand': 'Puma', 'date': '2018-04-05', 'price': '138.5', 'trading-name': 'Puma Bayswater', 'location': 'BAYSWATER', 'address': '502 Guildford Rd', 'phone': '(08) 9379 1322', 'latitude': '-31.919556', 'longitude': '115.929069', 'site-features': ', Open 24 hours'} ..snip.. ]\n```\n\nFuelwatcher can also transform the XML into JSON format. It is as simple as calling the `get_json` method.\n\n```python\n\napi = FuelWatch()\n\napi.query(region=1)\n\njson_response = api.get_json\n\n>>>> [\n>>>> {\n>>>> \"title\": \"143.9: United Boulder Kalgoorlie\",\n>>>> \"description\": \"Address: Cnr Lane St & Davis St, BOULDER, Phone: (08) 9093 1543\",\n>>>> \"brand\": \"United\",\n>>>> \"date\": \"2018-04-13\",\n>>>> \"price\": \"143.9\",\n>>>> ... snip ...\n>>>> \"longitude\": \"121.433746\",\n>>>> \"site-features\": \"Unmanned Station, \"\n>>>> }\n>>>> ]\n```\n\nFor most operations the `get_xml()` or `get_json()` method will be sufficient. If the developer wants to parse the raw RSS XML then the `get_raw()` method is available.\n\n```python\nget_raw = api.get_raw\n\nprint(get_raw)\n\n>>>> (b'\\r\\nFuelWatch Prices For North of River720http://www.fuelwatch.wa.gov.au05/04/2018 - North of Riveren-usCopyright 2005 FuelWatch... snip...\\r\\n')\n```\n\nThe query method takes several keyword arguments. By defaults it will return every fuel station across Western Australia.\n\nAs guide query takes the following kwargs\n\n```python\ndef query(self, product: int = None, suburb: str = None, region: int = None, \n brand: int = None, surrounding: str = None, day: str = None):\n```\n\nOf importance if `suburb` is set, then `surrounding` can set to `no` or left as `None`; it defaults to `yes` at the API endpoint. Setting `region` with `suburb` and `surrounding` will have unexpected results and is best left to their default settings.\n\nSimply put, if you want just one `suburb` then set `surrounding='no'` else leave the default. Only one `suburb` can be set per query. If a `region` is selected, do not set `surrounding` or `suburb`\n\nDoesn't make sense? Try this table.\n\nPARAMETERS | OPTION 1 | OPTION 2\n-----------|----------|---------\nsuburb | Y | N\nregion | N | Y\nsurrounding | Y or N | N\nproduct | Y | Y\nbrand | Y | Y\nday | Y | Y\n\nA list of valid suburbs, brands, regions and products (fuel types) can be found in [constants.py](https://github.com/danielmichaels/fuelwatcher/blob/master/fuelwatcher/constants.py) \n\nFuelwatcher will run validation on the `query` method and throw AssertionError is an invalid integer or string is input\n\n```python\napi.query(product=20) # product=20 is invalid\n\n>>> .... error snippet....\n>>> AssertionError: Invalid Product Integer.\n```\n\n## Release History\n\n* 0.2.0\n * __Braking Change!__\n * @property added raw, xml and json methods\n * json output now supported\n* 0.1.1\n * Include correct packages in setup.py\n* 0.1.0\n * First release live to PyPi\n* 0.1.0rc2\n * Minor formatting fixes\n* 0.1.0rc1\n * The first release candidate\n* 0.0.1\n * Work in progress\n\n## Meta\n\nDaniel Michaels \u2013 https://www.danielms.site\n\nDistributed under the MIT license. See ``LICENSE`` for more information.\n\n## Contributing\n\nAll requests, ideas or improvements are welcomed!\n\n1. Fork it\n2. Create your feature branch (`git checkout -b feature/fooBar`)\n3. Commit your changes (`git commit -am 'Add some fooBar'`)\n4. Push to the branch (`git push origin feature/fooBar`)\n5. Create a new Pull Request\n\n## Inspired by..\n\nA local python meetup group idea that turned into a PyPi package for anyone to use!\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/danielmichaels/fuelwatcher/tarball/0.2.0", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/danielmichaels/fuelwatcher", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "fuelwatcher", "package_url": "https://pypi.org/project/fuelwatcher/", "platform": "", "project_url": "https://pypi.org/project/fuelwatcher/", "project_urls": { "Download": "https://github.com/danielmichaels/fuelwatcher/tarball/0.2.0", "Homepage": "https://github.com/danielmichaels/fuelwatcher" }, "release_url": "https://pypi.org/project/fuelwatcher/0.2.0/", "requires_dist": [ "requests" ], "requires_python": "", "summary": "A simple XML scraper for FuelWatch.wa.gov.au fuel prices", "version": "0.2.0" }, "last_serial": 3762029, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "83e6444e1d273a98ca20819054e767eb", "sha256": "a833a671094189d800a31c2bc20fb3f826711e471f635b09d8ab19d0d24cb9c1" }, "downloads": -1, "filename": "fuelwatcher-0.1.0.tar.gz", "has_sig": false, "md5_digest": "83e6444e1d273a98ca20819054e767eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8561, "upload_time": "2018-04-06T14:42:44", "url": "https://files.pythonhosted.org/packages/5e/e6/2292c365b83ab7e61784e243dd2812001b38033672cc4e36d0e191685446/fuelwatcher-0.1.0.tar.gz" } ], "0.1.0rc2": [ { "comment_text": "", "digests": { "md5": "db6e1a45c8b91cbaf91c21529d1ee89f", "sha256": "8a101650e878765206180bb3ad5bb5182d3881f96c534782ad6745481d7d5faa" }, "downloads": -1, "filename": "fuelwatcher-0.1.0rc2.tar.gz", "has_sig": false, "md5_digest": "db6e1a45c8b91cbaf91c21529d1ee89f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8626, "upload_time": "2018-04-13T14:32:58", "url": "https://files.pythonhosted.org/packages/e0/fa/3bd78b3072ad92981a97663e003770cb8836b3815d174fc6c9b271e12123/fuelwatcher-0.1.0rc2.tar.gz" } ], "0.1.0rc3": [ { "comment_text": "", "digests": { "md5": "5c57d00dd9b2108ce22b23f8315efb23", "sha256": "fd4a3efbfadd7625a3fcdc52f24c2adaff230aaa8b4f52e1ad4520739d21e1b0" }, "downloads": -1, "filename": "fuelwatcher-0.1.0rc3.tar.gz", "has_sig": false, "md5_digest": "5c57d00dd9b2108ce22b23f8315efb23", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8564, "upload_time": "2018-04-13T14:33:00", "url": "https://files.pythonhosted.org/packages/9f/7a/d1b667d5e7954e7b4f9f6cfae2dabcabfdaec9be00eda5c0db60662732dc/fuelwatcher-0.1.0rc3.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "c9fc67f2f3b60efed769b0e255d01cb7", "sha256": "713ef9b08e83cea0c2e976047f97022927b9b6f0470097350c0e788f1625cd0a" }, "downloads": -1, "filename": "fuelwatcher-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c9fc67f2f3b60efed769b0e255d01cb7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8059, "upload_time": "2018-04-13T14:32:55", "url": "https://files.pythonhosted.org/packages/80/00/eb88b853f2ba273b881507b5889208567b685c39b4e19e25b5f64a42de0a/fuelwatcher-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d1a76a3bf4ad8adfc915ccb925cac418", "sha256": "5362f2418d8a10b8f9aeb578532fae68e1b72811617711131b6439d850e79d41" }, "downloads": -1, "filename": "fuelwatcher-0.1.1.tar.gz", "has_sig": false, "md5_digest": "d1a76a3bf4ad8adfc915ccb925cac418", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8774, "upload_time": "2018-04-07T23:02:10", "url": "https://files.pythonhosted.org/packages/83/0a/5a06eccbdf3bb2bffb28e15213166c24de504778aa412fdd5fcfc8a1211c/fuelwatcher-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "dcfdb50b055aa32b65c5ecb059145d8d", "sha256": "73126f6ed933a8a1d5d0037b4804d38482a1a388aac03121a7646802ca19d06d" }, "downloads": -1, "filename": "fuelwatcher-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "dcfdb50b055aa32b65c5ecb059145d8d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8425, "upload_time": "2018-04-13T14:32:56", "url": "https://files.pythonhosted.org/packages/72/09/b61dc9adc597a0418b8eac5f034d1a99238e851b878c4edf80103a09306f/fuelwatcher-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e6d8593f158b2d59262b30e9a8d5af8e", "sha256": "dcbe9e635ceb71fd995a2ceea4628b3a5fa3c3edd9136bba98f1ed51fd996898" }, "downloads": -1, "filename": "fuelwatcher-0.2.0.tar.gz", "has_sig": false, "md5_digest": "e6d8593f158b2d59262b30e9a8d5af8e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9186, "upload_time": "2018-04-13T14:33:04", "url": "https://files.pythonhosted.org/packages/4e/b2/3eb45b5bfe391c5c42c360da03ef151b468b3e2f53d76d268ee7f5ca792b/fuelwatcher-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dcfdb50b055aa32b65c5ecb059145d8d", "sha256": "73126f6ed933a8a1d5d0037b4804d38482a1a388aac03121a7646802ca19d06d" }, "downloads": -1, "filename": "fuelwatcher-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "dcfdb50b055aa32b65c5ecb059145d8d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8425, "upload_time": "2018-04-13T14:32:56", "url": "https://files.pythonhosted.org/packages/72/09/b61dc9adc597a0418b8eac5f034d1a99238e851b878c4edf80103a09306f/fuelwatcher-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e6d8593f158b2d59262b30e9a8d5af8e", "sha256": "dcbe9e635ceb71fd995a2ceea4628b3a5fa3c3edd9136bba98f1ed51fd996898" }, "downloads": -1, "filename": "fuelwatcher-0.2.0.tar.gz", "has_sig": false, "md5_digest": "e6d8593f158b2d59262b30e9a8d5af8e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9186, "upload_time": "2018-04-13T14:33:04", "url": "https://files.pythonhosted.org/packages/4e/b2/3eb45b5bfe391c5c42c360da03ef151b468b3e2f53d76d268ee7f5ca792b/fuelwatcher-0.2.0.tar.gz" } ] }