Coder Social home page Coder Social logo

weather_app_niche's Introduction

tonightWeather_FLASK

An extremely niche app that will tell you tonight's temperature. :)

STEPS to reproduce

  • git pull
  • create an environment
  • install requirements from requirements.txt
  • activate virtual envinronment
  • flask run

We have the app.py file that calls the pages into view. Once called, the page has a text box and a button into which users are expected to type in their cooridantes in the following style "38.2527 N, 85.7585 W".

Hitting the "Coat tonight?" button takes that inputted string and passes it to a function, "getAPIData".

Here, we strip the input text to remove any spaces on either side of the text.

Next, the String is formatted using split and strip to extract the directional data and the numeric data, seperately. The pole data is passed to a function "ifPositiveOrNegative" that returns;

  • "", if a positive direction
  • "-", if a negative direction The numeric data is combined with their corresponding signs and stored as "final_link"

This is then combined and added to the url, ""https://api.weather.gov/points/{final_link} and a get request is made.

We're looking to extract the link that will give us the forecasted temperature data from the response of the above request.

Once extracted, a get request is made to this link, and the various forecasts are stored under the 'periods' key which inturn is stored under the "properties" key.

We look through the list of forecasts and pick the one that says "Tonight" (corresponsing to Wednesday night, on the day of the interview.)

One of the three cheeky responses are chosen based on the value of the forecasted temperature and then displayed on the page.


Author: Swaroop Sk

weather_app_niche's People

Contributors

sknew93 avatar

Watchers

 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.