{ "info": { "author": "Cosimo Matteini", "author_email": "dev.matteini@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: OS Independent", "Programming Language :: Python :: 3.7" ], "description": "# ForecastPy\n\nA python package to interact with the OpenWeatherAPI in a simple and fast way.\n\n[Live demo](https://devmc.pythonanywhere.com) here.\n\n## Table of Contents\n\n- [Getting Started](#getting-started)\n - [Installation](#installation)\n - [Usage](#usage)\n- [Documentation](#documentation)\n - [Dependencies](#dependencies)\n - [Unit](#unit)\n - [Days](#days)\n - [Weather](#weather)\n - [Errors](#errors)\n- [Built With](#built-With)\n- [Version](#version)\n- [Author](#author)\n- [Licence](#license)\n\n## Getting Started\n\n### Installation\n\nUse the package manager [pip](https://pip.pypa.io/en/stable/) to install ForecastPy.\n\n```\npip install forecastpy\n```\n\n### Usage\n\n```\nfrom forecastpy import Weather, Unit, Days\n\n# Init Weather object with your open weather api key\nweather = Weather('YOUR_API_KEY')\n\n# Get current weather from a city name\nw = weather.get_current_weather('CITY_NAME', unit=Unit.METRIC)\n\n# Get weather for more than one day\nw2 = weather.get_days_weather('CITY_NAME', unit=Unit.METRIC, days=Days.TWO)\n```\n\n## Documentation\n\n### Dependencies\n\n- requests\n\n### Unit\n\nUnit is a class which makes thing easier when you have to choose the unit type you want from the weather forecast.\nThe available units are:\n\n- Kelvin (Default option)\n- Metric\n- Fahrenheit\n\n##### Usage\n\n```\nUnit.METRIC # return 'metric'\nUnit.FAHRENHEIT # return 'imperail'\n...\n```\n\n### Days\n\nDays is a class which makes thing easier when you have to choose the number of days you want.\nThe lowest number is 2 and the maximum is 5 (which is the higher number of day set on the free version of the OpenWeatherAPI)\n\nThe available days are:\n\n- Two\n- Three\n- Four\n- Five (Default option)\n\n##### Usage\n\n```\nDays.TWO # return 2\nDays.THREE # return 3\n...\n```\n\n### Weather\n\nWeather is the class you'll need to use to interact with the OpenWeatherAPI.\nIt requires the OpenWeatherAPI key as its only parameter when you have to initialize it.\nLearn more about the [OpenWeatherAPI](https://openweathermap.org/api).\n\n#### Methods\n\n#### get_current_weather(city_name, unit = Unit.KELVIN)\n\nIt makes an http request (throught the [requests](http://2.python-requests.org/en/master/) package) to the OpenWeatherMap API to get the current weather forecast of the city you searched.\n\n| Parameter | Description | Required |\n| --------- | ----------------------------------------------------------------------------------- | -------- |\n| city_name | a string that represents the city you want to know the weather | Yes |\n| unit | default unit is kelvin (You can leave it empty). See [Unit](#unit) for futher info. | No |\n\nThis method returns a dictionary like the one below:\n\n```\n{\n 'is_status_code_ok': True,\n 'id': 2643743,\n 'name': 'London',\n 'country': 'GB',\n 'forecast':{\n 'main': 'Drizzle',\n 'description': 'light intensity drizzle',\n 'temperature': 280.32,\n 'humidity': 81,\n 'wind_speed': 4.1,\n 'icon': '09d'\n }\n}\n```\n\nFor errors, see the [Errors](#errors) section.\n\n#### get_days_weather(self, city_name, unit = Unit.KELVIN, days = Days.FIVE)\n\nIf you want to know the weather of a city for a maximum of 5 days (including the current day) you have to use this method.\n\n| Parameter | Description | Required |\n| --------- | ------------------------------------------------------------------------------------ | -------- |\n| city_name | a string that represents the city you want to know the weather | Yes |\n| unit | default unit is kelvin (You can leave it empty). See [Unit](#unit) for futher info. | No |\n| days | default day is five [5] (You can leave it empty). See [Days](#Days) for futher info. | No |\n\nThis method returns a dictionary like the one below (in this example the unit was metric and the days were two):\n\n```\n{\n 'is_status_code_ok':True,\n 'id':2643743,\n 'name':'London',\n 'country':'GB',\n 'forecasts':[\n {\n 'date':'28/05/2019',\n 'temp_min':13,\n 'temp_max':18,\n 'weather':[\n {\n 'time':'17:00:00',\n 'main':'Clear',\n 'description':'Clear sky',\n 'temperature':17,\n 'wind_speed':3.88,\n 'icon':'01d'\n },\n {\n 'time':'20:00:00',\n 'main':'Clear',\n 'description':'Clear sky',\n 'temperature':16,\n 'wind_speed':2.86,\n 'icon':'01d'\n },\n {\n 'time':'23:00:00',\n 'main':'Rain',\n 'description':'Light rain',\n 'temperature':13,\n 'wind_speed':0.68,\n 'icon':'10n'\n }\n ]\n },\n {\n 'date':'29/05/2019',\n 'temp_min':10,\n 'temp_max':18,\n 'weather':[\n {\n 'time':'02:00:00',\n 'main':'Rain',\n 'description':'Light rain',\n 'temperature':11,\n 'wind_speed':1.35,\n 'icon':'10n'\n },\n {\n 'time':'05:00:00',\n 'main':'Clouds',\n 'description':'Overcast clouds',\n 'temperature':10,\n 'wind_speed':1.26,\n 'icon':'04n'\n },\n {\n 'time':'08:00:00',\n 'main':'Clouds',\n 'description':'Broken clouds',\n 'temperature':11,\n 'wind_speed':1.21,\n 'icon':'04d'\n },\n {\n 'time':'11:00:00',\n 'main':'Clouds',\n 'description':'Scattered clouds',\n 'temperature':15,\n 'wind_speed':1.57,\n 'icon':'03d'\n },\n {\n 'time':'14:00:00',\n 'main':'Clouds',\n 'description':'Scattered clouds',\n 'temperature':15,\n 'wind_speed':4.3,\n 'icon':'03d'\n },\n {\n 'time':'17:00:00',\n 'main':'Clouds',\n 'description':'Broken clouds',\n 'temperature':15,\n 'wind_speed':4.64,\n 'icon':'04d'\n },\n {\n 'time':'20:00:00',\n 'main':'Clouds',\n 'description':'Broken clouds',\n 'temperature':15,\n 'wind_speed':3.7,\n 'icon':'04d'\n },\n {\n 'time':'23:00:00',\n 'main':'Clouds',\n 'description':'Overcast clouds',\n 'temperature':14,\n 'wind_speed':3.79,\n 'icon':'04n'\n }\n ]\n }\n ]\n}\n```\n\nFor errors, see the [Errors](#errors) section.\n\n### Errors\n\nIn case something goes wrong this dictionary is what is returned:\n\n```\n{\n 'is_status_code_ok': False,\n 'cod': '404',\n 'message': 'city not found'\n}\n```\n\nCommon status code error:\n\n| Code | Description |\n| ---- | --------------------------------------------------------------------------------- |\n| 400 | Bad Request - city_name or API_KEY not set |\n| 401 | Invalid API key. Please see http://openweathermap.org/faq#error401 for more info. |\n| 404 | city not found |\n| 429 | API key blocked |\n| 500 | internal server error |\n\n#### Check the status code of your request\n\nIf you want to quickly check if your request was successful or not, just check the `is_status_code_ok` like:\n\n```\nw['is_status_code_ok']\n```\n\nIf the response status code is less than 400 it's `True` otherwise it's `False`\n\n## Built With\n\n- [Python](https://python.org) (3.7)\n\n## Version\n\n> 1.1.0\n\nOptimization and cleanup code. Add `NoneType` control to the class constructur to prevent error.\n\n> 1.0.2\n\nTemperature is now a int type\n\n> 1.0.1\n\nAdd install_requires to setup.py file.\n\n> 1.0.0\n\nInitial release. Include features like get the current weather of a city or get the weather of a city for more than one day.\n\n## Author\n\n> **Cosimo Matteini** - [devmatteini on github](https://github.com/devmatteini)\n\n## License\n\nThis project is licensed under the GNU General Public License v3.0 - see the [LICENSE](https://github.com/devmatteini/forecastpy/blob/master/LICENSE) file for details\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/devmatteini/forecastpy", "keywords": "weather forecast openweathermap", "license": "", "maintainer": "", "maintainer_email": "", "name": "forecastpy", "package_url": "https://pypi.org/project/forecastpy/", "platform": "", "project_url": "https://pypi.org/project/forecastpy/", "project_urls": { "Homepage": "https://github.com/devmatteini/forecastpy" }, "release_url": "https://pypi.org/project/forecastpy/1.1.0/", "requires_dist": [ "requests" ], "requires_python": "", "summary": "A python package to interact with the OpenWeatherAPI in a simple and fast way.", "version": "1.1.0" }, "last_serial": 5527020, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "a2273859a9e9fc75d2e7b2d46e955d4d", "sha256": "71ad061d7e6b1494ff841cdc05bcd29b9aa387d084145d1ab682af7f15dc25d8" }, "downloads": -1, "filename": "forecastpy-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "a2273859a9e9fc75d2e7b2d46e955d4d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17692, "upload_time": "2019-05-29T16:06:36", "url": "https://files.pythonhosted.org/packages/bd/e8/c2342da612e6e04f930114b1193cac117dc839c38998430d3c0e42bbd4f2/forecastpy-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b3994e97cc1b4812543d1d86cfa39100", "sha256": "7661fa4f7357092ef09751803df446ec34a1e91e79a4736802f8f1120f038d3a" }, "downloads": -1, "filename": "forecastpy-1.0.0.tar.gz", "has_sig": false, "md5_digest": "b3994e97cc1b4812543d1d86cfa39100", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5534, "upload_time": "2019-05-29T16:06:38", "url": "https://files.pythonhosted.org/packages/bc/a0/e92b688facf0d100e1f9fb32f3c43afcf5416c218036b2b9f37204a2f12d/forecastpy-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "e8969722aa1dc6cec18d9ef57ee349da", "sha256": "d7ced3a908cd4b7b4630cadf862b21dcda1e5e78a718cb921b4a03705f0340d5" }, "downloads": -1, "filename": "forecastpy-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "e8969722aa1dc6cec18d9ef57ee349da", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17727, "upload_time": "2019-05-30T15:22:39", "url": "https://files.pythonhosted.org/packages/0a/35/f9e2c5e11e6df26303c0d7b19d7e085b10c4d27aa127c7a2d49549f44cfc/forecastpy-1.0.1-py3-none-any.whl" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "b97dc6636fe408e4dffb8c050524ea04", "sha256": "2433d004912695db819c6279e16bcd6c6f9b64b81134b1832d90d08784136458" }, "downloads": -1, "filename": "forecastpy-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "b97dc6636fe408e4dffb8c050524ea04", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17761, "upload_time": "2019-07-12T21:18:37", "url": "https://files.pythonhosted.org/packages/3a/40/0c64619ed9b7bdbcab16956caae893e058e6d1b155dd173b58b501b41633/forecastpy-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d0ff7f283c0775982f94568ce0d912ae", "sha256": "e04b8064c8b1ad60a13857f85b5044c8794968c702f4d037a71afe44238ace4a" }, "downloads": -1, "filename": "forecastpy-1.0.2.tar.gz", "has_sig": false, "md5_digest": "d0ff7f283c0775982f94568ce0d912ae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5651, "upload_time": "2019-07-12T21:18:39", "url": "https://files.pythonhosted.org/packages/3a/7b/e6042a424a919dd7b57457b8f0ea1b6129df307ae92d1f0d20676289292b/forecastpy-1.0.2.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "f8c45d05b94766cb83f12d119f16c0d0", "sha256": "3356479f3b826c515221e6a990acc0ec5a44cfed9fe387dfdfd05efa4047b921" }, "downloads": -1, "filename": "forecastpy-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "f8c45d05b94766cb83f12d119f16c0d0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17931, "upload_time": "2019-07-13T14:37:36", "url": "https://files.pythonhosted.org/packages/87/7f/709d3dcff643a62993c0f863bd4c6ad44339db14b21bf3a97c4fccca66c2/forecastpy-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "99ac07dea5b2ed482c9ee3effa60fdec", "sha256": "62f69d2d1538af7d59fde5d0fea2a88fc7f95ba84db2702af016173a3a190922" }, "downloads": -1, "filename": "forecastpy-1.1.0.tar.gz", "has_sig": false, "md5_digest": "99ac07dea5b2ed482c9ee3effa60fdec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5884, "upload_time": "2019-07-13T14:37:38", "url": "https://files.pythonhosted.org/packages/4e/10/417085524edcf31d68a2fcda7dfbb5ba6b040a2ca03ebe5ca57caa37966b/forecastpy-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f8c45d05b94766cb83f12d119f16c0d0", "sha256": "3356479f3b826c515221e6a990acc0ec5a44cfed9fe387dfdfd05efa4047b921" }, "downloads": -1, "filename": "forecastpy-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "f8c45d05b94766cb83f12d119f16c0d0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17931, "upload_time": "2019-07-13T14:37:36", "url": "https://files.pythonhosted.org/packages/87/7f/709d3dcff643a62993c0f863bd4c6ad44339db14b21bf3a97c4fccca66c2/forecastpy-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "99ac07dea5b2ed482c9ee3effa60fdec", "sha256": "62f69d2d1538af7d59fde5d0fea2a88fc7f95ba84db2702af016173a3a190922" }, "downloads": -1, "filename": "forecastpy-1.1.0.tar.gz", "has_sig": false, "md5_digest": "99ac07dea5b2ed482c9ee3effa60fdec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5884, "upload_time": "2019-07-13T14:37:38", "url": "https://files.pythonhosted.org/packages/4e/10/417085524edcf31d68a2fcda7dfbb5ba6b040a2ca03ebe5ca57caa37966b/forecastpy-1.1.0.tar.gz" } ] }