readme updates also 401 status_code becomes skippable

This commit is contained in:
Shawn Grigson 2023-09-12 02:34:56 -05:00
parent bda8bf5ebb
commit d1fe11abf5
3 changed files with 14 additions and 2 deletions

View File

@ -386,6 +386,14 @@ Skip the fetching of blocklists from any URLs that are configured.
Skip the fetching of blocklists from any remote instances that are configured. Skip the fetching of blocklists from any remote instances that are configured.
### override_private_comment
Defaults to None.
Stamp all *new* blocks pushed to a remote server with this comment or code.
Helps to identify blocks you've created on a server via this process versus ones that
already existed.
### mergeplan ### mergeplan
If two (or more) blocklists define blocks for the same domain, but they're If two (or more) blocklists define blocks for the same domain, but they're

View File

@ -77,8 +77,9 @@ blocklist_instance_destinations = [
# merge_threshold_type = 'count' # merge_threshold_type = 'count'
# merge_threshold = 0 # merge_threshold = 0
## set an override private comment ## set an override private comment to be added when pushing a NEW block to an instance
# override_private_comment = 'Updated by Fediblockhole' # this does not require importing private comments
# override_private_comment = 'Added by Fediblock Sync'
## Set which fields we import ## Set which fields we import
## 'domain' and 'severity' are always imported, these are additional ## 'domain' and 'severity' are always imported, these are additional

View File

@ -402,6 +402,9 @@ def fetch_instance_blocklist(host: str, token: str=None, admin: bool=False,
link = True link = True
while link: while link:
response = requests.get(url, headers=headers, timeout=REQUEST_TIMEOUT) response = requests.get(url, headers=headers, timeout=REQUEST_TIMEOUT)
if response.status_code == 401:
log.error(f"Cannot fetch remote blocklist. Access token has been revoked for {host}, skipping....")
break
if response.status_code != 200: if response.status_code != 200:
log.error(f"Cannot fetch remote blocklist: {response.content}") log.error(f"Cannot fetch remote blocklist: {response.content}")
raise ValueError("Unable to fetch domain block list: %s", response) raise ValueError("Unable to fetch domain block list: %s", response)