mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2026-09-24 22:36:33 +00:00
fixed import errors
This commit is contained in:
@@ -2,10 +2,9 @@ import hashlib
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
import urllib3
|
||||
import requests
|
||||
import simplejson
|
||||
import json
|
||||
from changedetectionio import content_fetcher, html_tools
|
||||
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
@@ -57,17 +56,18 @@ class perform_site_check():
|
||||
# Tweak the base config with the per-watch ones
|
||||
request_headers = self.datastore.data['settings']['headers'].copy()
|
||||
|
||||
if self.datastore.get_val(uuid, 'external_header_server') is not None:
|
||||
if self.datastore.data['watching'][uuid].get('external_header_server') is not None:
|
||||
try:
|
||||
resp = requests.get(self.datastore.get_val(uuid, 'external_header_server'))
|
||||
resp = requests.get(self.datastore.data['watching'][uuid].get('external_header_server'))
|
||||
if resp.status_code != 200:
|
||||
raise Exception("External header server returned non-200 response. Please check the URL for the server")
|
||||
|
||||
data = json.loads(resp.text.strip())
|
||||
request_headers.update(resp.json())
|
||||
|
||||
except simplejson.errors.JSONDecodeError:
|
||||
except json.decoder.JSONDecodeError:
|
||||
raise Exception("Failed to decode JSON response from external header server")
|
||||
|
||||
|
||||
request_headers.update(extra_headers)
|
||||
|
||||
# https://github.com/psf/requests/issues/4525
|
||||
|
||||
Reference in New Issue
Block a user