Download a growing log file continuously via HTTP

Viewed 26

I managed to get data from the target (see code below), but I want to continuously download as the log file on the server is appended to.

from importlib.resources import path
import requests
import json
import shutil
import logging

logging.captureWarnings(True)

url = "https://<IP address>/wga/reverseproxy_logging/instance/wga/request.log"

headers = {'Accept': 'application/json'}

r = requests.get(url, stream=True, headers=headers, verify=False, auth=('user','password'))
with open('request.log', 'wb') as out_file:
    shutil.copyfileobj(r.raw, out_file)
0 Answers
Related