Git Product home page Git Product logo

requests-zipfile-redis-cherrypy-jquery's Introduction

Requests-ZipFile-Redis-Cherrypy-jQuery

A repo for basic usage of requests, zipfile, redis , jQuery and cherrypy.

There are two parts of this repository :

  1. download_bhavcopy_equity_files.py : a script to download, unzip, parse a CSV file and populate a REDIS instance according to the respective entries.

Upon visiting the link "https://www.bseindia.com/markets/MarketInfo/BhavCopy.aspx" and examining the "Bhavcopy" CSV file link, we see that part of the link is actually the present date, or last working day (in case of weekends). We download a .zip archive from the link based on this rationale. We unzip and parse the entries in the CSV using native python libraries and update these entries in Redis DB using a "HASHES" , the key being a counter variable and value being the parsed dictionary. Lastly, we update the counter variable in the DB in case if required later.

2.web_app.py : Front-End Web application containing a Web App and a REST API to provide a layer of communication with the updated Redis DB

This is main logic behind the frontend of the project hosted at "http://ec2-18-220-250-1.us-east-2.compute.amazonaws.com/" (when this README was last updated). We create a REST service at "http://ec2-18-220-250-1.us-east-2.compute.amazonaws.com/generator" for interaction with the REDIS DB. We return Top 10 entries on a "GET" request at "..../generator". If we append "..../generator?records=(some number n)" to the REST endpoint, we can get information for the respective n TOP entries in our REDIS DB. Upon doing a "POST" request with a search string, we get the entries in return whose name contain our seach string. We link the REST API and index view to our webapp. In our Index View, we use jQuery AJAX to do "GET" and "POST" requests, and populate the the TOP 10 and search tables in our index page accordingly.

I have provided a redis configuration file which should be used to start the redis DB with the command "redis-server redis.conf", If any other Redis DB is used (different address or port), the scripts need to be modified accordingly. The webapp starts on 0.0.0.0 ,i.e, localhost by default. If any changes are made here, same should be changes in the jQuery adresses as well.

requests-zipfile-redis-cherrypy-jquery's People

Contributors

kinjaldas 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.