dockerize!

This commit is contained in:
Matteo Rosati
2026-01-14 23:54:51 +01:00
parent 1e76403565
commit 46ddcc16da
14 changed files with 1362 additions and 18 deletions

24
main.py
View File

@@ -2,10 +2,14 @@ import os
import argparse
from typing import List
from datetime import datetime
from dotenv import load_dotenv
from ingress import IngressAPI
from models import EventType, Plext
load_dotenv()
def parse_timestamp(value: str) -> int:
"""
Parse timestamp from either milliseconds (int) or ISO 8601 string.
@@ -40,6 +44,14 @@ def parse_timestamp(value: str) -> int:
def print_plexts(plexts: List[Plext]):
"""Print plexts to stdout in a human-readable format.
Sorts plexts by timestamp (ascending - oldest first) and prints each
plext with its timestamp, event type, text, and coordinates if available.
Args:
plexts: List of Plext objects to print.
"""
# Sort plexts by timestamp (ascending - oldest first)
sorted_plexts = sorted(plexts, key=lambda p: p.timestamp)
@@ -57,6 +69,11 @@ def print_plexts(plexts: List[Plext]):
def main():
"""Main entry point for the Ingress Intel Report CLI.
Parses command-line arguments, initializes the IngressAPI client,
fetches plexts based on the specified filters, and prints them.
"""
parser = argparse.ArgumentParser(description="Ingress Intel Report")
parser.add_argument(
"--event-types",
@@ -94,15 +111,12 @@ def main():
# It's recommended to set the INGRESS_COOKIE environment variable
# instead of hardcoding the cookie in the script.
cookie = os.getenv(
"INGRESS_COOKIE",
"csrftoken=3yUkOxJ2lkc49AStOe8JDpmP1vWI5WTXpV5hlMKTRB4sisPGLdv1IXMBvKfYAZmQ; sessionid=.eJyrViotTi3yTFGyUrJINTA2SbG0MDdPSjJPMjVU0gHLueYmZuYApYvyixNLMvVyE0tKUvMd0kGiesn5uUBVxanFxZn5eWGpRSAKqNRIqRYA3zUdAQ:1veJTk:haQGju5WSpAUlMygA1AF26nvx1I; ingress.intelmap.shflt=viz; _ncc=1; ingress.intelmap.zoom=16; ingress.intelmap.lng=12.271176494006568; ingress.intelmap.lat=45.47531344367309",
)
cookie = os.getenv("INGRESS_COOKIE")
# This is the version from the curl command in json_doc.md
# Replace with a valid one if it expires
client = IngressAPI(
version="e6d07d367cf3d1d959dd9627c9ae3827352409d1",
version=os.getenv("V"),
cookie=cookie,
)