Skip to content

Commit

Permalink
Agrego docstring de interfaz por línea de comandos.
Browse files Browse the repository at this point in the history
  • Loading branch information
abenassi committed Dec 13, 2016
1 parent fd1d199 commit 8ab2dd1
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pydatajson/pydatajson.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import json
import jsonschema
import requests
from pprint import pprint

ABSOLUTE_PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))

Expand Down Expand Up @@ -215,13 +216,21 @@ def _update_response(validation_error, response):


def main():
"""En caso de ejecutar el módulo como script, se corre esta función."""
"""Permite ejecutar el módulo por línea de comandos.
Valida un path o url a un archivo data.json devolviendo True/False si es
válido y luego el resultado completo.
Example:
python pydatajson.py http://181.209.63.71/data.json
python pydatajson.py ~/github/pydatajson/tests/samples/full_data.json
"""
datajson_file = sys.argv[1]
dj = DataJson()
bool_res = dj.is_valid_catalog(datajson_file)
full_res = dj.validate_catalog(datajson_file)
print(bool_res)
print(full_res)
pprint(bool_res)
pprint(full_res)


if __name__ == '__main__':
Expand Down

0 comments on commit 8ab2dd1

Please sign in to comment.