Giter VIP home page Giter VIP logo

egov's Introduction

Hi 👋 I love building things that work

Ping me if you need help building something that makes the world a better place.

Buy Me A Coffee

egov's People

Contributors

dependabot[bot] avatar palmerabollo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

egov's Issues

Datos de tráfico DGT (estado + incidencias)

Datos de radares (DGT)

import requests
import json
import bs4 as bs
from urllib.parse import urljoin
from tabula import read_pdf

base_url = "http://www.dgt.es/es/el-trafico/control-de-velocidad/"
text_pdf = "aquí"

def find_pdf_url(base_url,text_pdf):
  # Get the website
  r = requests.get(base_url)
  if r.ok:
    # Parse it to find the download link
    html = bs.BeautifulSoup(r.text)

    # Find all links
    links = html.find_all("a", href=True)

    # Find the link with the word from the link
    pdf = [_ for _ in links if text_pdf in _.text]

    # Create absolute path and return
    pdf_relative_url = pdf[0].get("href")
    pdf_url = urljoin(base_url, pdf_relative_url)

    return pdf_url
  else:
    print("Error trying to get {}".format(base_url))
    r.raise_for_status()

# Find the url of the pdf
pdf_url = find_pdf_url(base_url, text_pdf)

# Parse pdf to json and save to disk
json_file = read_pdf(pdf_url, encoding="latin-1", pages="all", output_format="json")
with open('data.json', 'w') as outfile:
json.dump(json_file, outfile)

Puede ser buen caso para probar #5

Complementar con datos de puntos kilométricos:

Migrar demo de heroku a otro proveedor

"Starting November 28th, 2022, free Heroku Dynos, free Heroku Postgres, and free Heroku Data for Redis® will no longer be available."

Esto rompe la demo que está corriendo en egov-demo.herokuapp.com y que consumen los ejemplos del portal.
Avisad si conocéis alternativas ya que el proyecto no tiene presupuesto para mantener infraestructura propia.

Acceso mediante apikey

Acceso al API con apikey para generación de estadísticas de uso y filtro de usuarios abusivos.

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.