GithubHelp home page GithubHelp logo

dnv-scraper's Introduction

dnv_scraper

Scraper for argentinian National Roads Department (DNV in spanish) traffic information.

It is used to scrape traffic data from the site of "Dirección Nacional de Vialidad" wich is the national roads department authority in Argentina: http://transito.vialidad.gov.ar:8080/SelCE_WEB/intro.html

I am currently heavy-refactoring and translating into english old pieces of code from my scratch starts as a self-taught programmer, this one got fairly prettier but some pieces of code are still obscure. It works very well anyway.

You can download or clone the repository on your local computer to use it.

Command-line interface

It can be called through command line interface passing from zero to 3 parameters:

  1. Excel file name (always with .xlsx)
  2. Roads (one road, or many separated by commas)
  3. Years (one year, or many separated by commas) - Starting at 2006
python dnv_scraper.py some_traffic_data.xlsx 0014,0003 2006,2008,2013

Parameters are optional. You could call just the script alone to scrape all data (all roads, all years from 2006 up to last year) or add less than three parameters (always in excel-roads-years order).

python dnv_scraper.py
python dnv_scraper.py some_traffic_data.xlsx
python dnv_scraper.py some_traffic_data.xlsx 0014,0003

Imports

You could also import ´scrape_traffic_data´ method from inside the directory method and use it.

from dnv_scraper import scrape_traffic_data
years = [2006, 2008, 2013]
roads = ["0014", "0003"]
excel_output = "some_traffic_data.xlsx"
scrape_traffic_data(years, roads, excel_output)

Again, parameters could be "None" or not passed at all.

from dnv_scraper import scrape_traffic_data
scrape_traffic_data()

Also, you could call parameters with keyword arguments.

from dnv_scraper import scrape_traffic_data
scrape_traffic_data(years=[2006, 2013], roads=["0014"])

Test

To test the proper functioning of the module you can run the unit test.

python test_dnv_scraper.py

Or from inside the directory.

import test_dnv_scraper
test_dnv_scraper.main()

dnv-scraper's People

Contributors

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