Skip to content

Commit

Permalink
Merge pull request #2 from dadosjusbr/crawler-version
Browse files Browse the repository at this point in the history
crawler version
  • Loading branch information
joellensilva authored Feb 15, 2023
2 parents e190d0a + 81c1788 commit 0461410
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ protoDadosjusbr>=0.7
protobuf==3.18.0
odfpy==1.4.1
xlrd==2.0.1
openpyxl==3.0.10
requests==2.28.1
openpyxl==3.0.10
22 changes: 6 additions & 16 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from google.protobuf.timestamp_pb2 import Timestamp
from google.protobuf import text_format
from parser import parse
import requests

if "YEAR" in os.environ:
YEAR = os.environ["YEAR"]
Expand All @@ -26,24 +25,15 @@
else:
OUTPUT_FOLDER = "/output"

if "GIT_COMMIT" in os.environ:
PARSER_VERSION = os.environ["GIT_COMMIT"]
if "CRAWLER_VERSION" in os.environ:
CRAWLER_VERSION = os.environ["CRAWLER_VERSION"]
else:
PARSER_VERSION = "unspecified"
CRAWLER_VERSION = "unspecified"

# Pegando o ID do último commit do coletor
headers = {
'Accept': 'application/vnd.github+json',
'X-GitHub-Api-Version': '2022-11-28',
}
response = requests.get(
'https://api.github.com/repos/dadosjusbr/coletor-mpt/commits', headers=headers)

if response.status_code == 200:
response = response.json()
CRAWLER_VERSION = response[0]["sha"]
if "PARSER_VERSION" in os.environ:
PARSER_VERSION = os.environ["PARSER_VERSION"]
else:
CRAWLER_VERSION = "unspecified"
PARSER_VERSION = "unspecified"


def parse_execution(data, file_names):
Expand Down

0 comments on commit 0461410

Please sign in to comment.