Git Product home page Git Product logo

enc_requests's Introduction

encode_requests

For a given date/time range calculates:

  1. the total number of accepted answers.
  2. the average score for all the accepted answers.
  3. the average answer count per question.
  4. the comment count for each of the 10 answers with the highest score.
  5. Collects and returns the calculated statistics in tabular, HTML or JSON format.

REQUIREMENTS

Install python mock.

$ sudo pip install mock
$ sudo pip install requests

INSTALL

Alternatevely if you have donwloaded source code:

python setup.py install

HOW TO RUN IT

Inside src code Run:

alias stats=python main_module.py
$ stats --help
Usage: stats --since <date>  --until <date> [--output-format] <tab|json|html>

Options:
  -h, --help       show this help message and exit
  --since          1.  start date of request
  --until          2.  end date of request
  --output-format  3.  format of output tab, json, html

You have to provide since date and until date, output-format is optional and defaults to tab:

stats --since '2011-11-15 10:00:00' --until '2016-06-05 10:00:00' -output-format html

Assumptions: Only 20 pages are retrieved per request. It is easy to change the code for 100 pages which is the maximum page size limit.

TESTING

bash run_tests.sh

Alternatively you can run explicitily tests:

python -m unittest test_parser
python -m unittest test_format_output
python -m unittest test_collector

enc_requests's People

Contributors

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