Git Product home page Git Product logo

weather-scraper's Introduction

Weather Scraper

Approach

Important Endpoints

Run as command line tool

  • Uncomment "the argparse if" part and comment the app.run part.

Run as Web Based Service

  • Uncomment the "app.run if" part and comment the argparse part.

How to install

  • Download the file as zip.
  • Open command prompt or terminal with python3 installed in it.
  • Traverse to the weather folder containing setup.py
  • Type 'pip install -r requirements.txt'
  • Type 'pip install .'
  • After successful completion, the package can be imported as 'weather'
shell$ pip install .

Processing /mnt/d/weather
Installing collected packages: weather-scraper
  Running setup.py install for weather-scraper ... /
done
Successfully installed weather-scraper-0.1
  • In python shell, after declaring main, place info must be passed to run the package
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import weather.main

Web Based Service

  • It uses flask as a service
    • Routes like api, api/v1, api/v1/weather

Command

C:\Users\Rai>curl -G http://127.0.0.1:5000/api/v1/weather?place=Mumbai

Output

{
  "altimeter": 1008.13,
  "barometerChange": 2.03,
  "barometerCode": 1,
  "barometerTrend": "Rising",
  "dewPoint": 25,
  "feelsLike": 32,
  "gust": null,
  "humidity": 87,
  "icon": 21,
  "obsQualifierCode": null,
  "obsQualifierSeverity": null,
  "observationTime": "2019-09-11T20:09:29+0530",
  "phrase": "Haze",
  "precip24Hour": 46.74,
  "snowDepth": 0.0,
  "temperature": 27,
  "temperatureMaxSince7am": 29,
  "uvDescription": "Low",
  "uvIndex": 0,
  "visibility": 3.22,
  "windDirCompass": "S",
  "windDirDegrees": 190,
  "windSpeed": 8
}

Command

python3 main.py --place Mumbai --forecast --monthly

Output

{
    "altimeter": 1007.11,
    "barometerTrend": "Rising",
    "barometerCode": 1,
    "barometerChange": 0.68,
    "dewPoint": 24,
    "feelsLike": 32,
    "gust": null,
    "humidity": 84,
    "icon": 11,
    "observationTime": "2019-09-11T18:24:15+0530",
    "obsQualifierCode": null,
    "obsQualifierSeverity": null,
    "phrase": "Light Rain",
    "precip24Hour": 45.97,
    "snowDepth": 0.0,
    "temperature": 27,
    "temperatureMaxSince7am": 29,
    "uvIndex": 0,
    "uvDescription": "Low",
    "visibility": 4.83,
    "windSpeed": 10,
    "windDirCompass": "SSW",
    "windDirDegrees": 210
}

TODO

  • The monthly and daily json respone are intermixed, need a little parsing

  • The api endpoints need a little categorisation as it is not officially documented.

  • Need a little parsing in large data

weather-scraper's People

Contributors

nihalrai avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.