mirror of
https://github.com/FutaGuard/LowTechFilter.git
synced 2025-06-21 05:21:02 +08:00
⚡️ 保護 endpoint
This commit is contained in:
parent
97b117d30f
commit
f3fb7210da
4
.github/workflows/tw165.yml
vendored
4
.github/workflows/tw165.yml
vendored
@ -16,7 +16,9 @@ jobs:
|
||||
cache: 'pip' # caching pip dependencies
|
||||
- run: pip install -r AutoBuild/requirements.txt && python AutoBuild/tw_165.py
|
||||
env:
|
||||
tw165: ${{ vars.TW165 }}
|
||||
tw165json: ${{ vars.TW165JSON }}
|
||||
tw165csv: ${{ vars.TW165CSV }}
|
||||
auth: ${{ secrets.AUTH }}
|
||||
- name: push
|
||||
uses: github-actions-x/commit@v2.9
|
||||
with:
|
||||
|
@ -1,4 +1,5 @@
|
||||
import requests
|
||||
from requests.auth import HTTPBasicAuth
|
||||
from json.decoder import JSONDecodeError
|
||||
import logging
|
||||
import os
|
||||
@ -10,11 +11,18 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def main():
|
||||
url = os.getenv('tw165', None)
|
||||
auth = os.getenv('auth', None)
|
||||
url = os.getenv('tw165json', None)
|
||||
if not url:
|
||||
logger.critical('URL NOT SET')
|
||||
return
|
||||
r = requests.get(url)
|
||||
if not auth:
|
||||
logger.critical('AUTH NOT SET')
|
||||
return
|
||||
|
||||
user, passwd = auth.split(':')
|
||||
basic = HTTPBasicAuth(user, passwd)
|
||||
r = requests.get(url, auth=basic)
|
||||
if r.status_code != 200:
|
||||
logger.critical('Fetch Data Err')
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user