summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b4c4d48)
Change-Id: Ib60ef2005618f94da34da1910fb26f95d77bb7a2
Signed-off-by: aguilard <e.dah.tid@telefonica.com>
# limitations under the License.
#######################################################################################
from datetime import datetime
# limitations under the License.
#######################################################################################
from datetime import datetime
import os
from random import randint
import os
from random import randint
+logging.basicConfig(
+ format="%(asctime)s %(levelname)s %(filename)s:%(lineno)s %(message)s",
+ datefmt="%Y/%m/%d %H:%M:%S",
+)
+logger = logging.getLogger(__name__)
+logger.setLevel(logging.INFO)
rnd = str(randint(0, 999999)).rjust(6, "0")
timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
dag_run_id = output_endpoint + "_" + timestamp + "_" + rnd
rnd = str(randint(0, 999999)).rjust(6, "0")
timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
dag_run_id = output_endpoint + "_" + timestamp + "_" + rnd
- print(f"HTTP POST {url}...")
+ logger.info(f"HTTP POST {url}")
req = requests.post(
url=url,
auth=(airflow_user, airflow_pass),
json={"dag_run_id": dag_run_id, "conf": content},
)
req = requests.post(
url=url,
auth=(airflow_user, airflow_pass),
json={"dag_run_id": dag_run_id, "conf": content},
)
+ logger.info(f"Response: {req.text}")
# timeout and retries
except Exception as e:
# timeout and retries
except Exception as e:
- print(f"HTTP error: {repr(e)}")
+ logger.error(f"HTTP error: {repr(e)}")
raise requests.HTTPException(status_code=403, detail=repr(e))
raise requests.HTTPException(status_code=403, detail=repr(e))