Skip to content

Commit

Permalink
Update rthk.py
Browse files Browse the repository at this point in the history
  • Loading branch information
raileo98 authored Oct 19, 2024
1 parent 88a0523 commit 7a8102c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions code/rthk.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,23 @@ def check():
'https://images.weserv.nl/quota'
]

for url in urls:
try:
headersForCheck = dict(session.headers)
headersForCheck['Cache-Control'] = 'no-cache'
headersForCheck['Pragma'] = 'no-cache'
print( f'headersForCheck: { headersForCheck }' )
response = get_response.get(url, timeout=2, headers=headersForCheck )
if response.ok:
# print(f'使用代理獲取 {url} 成功: \nhttp_version: {response.http_version} \n{response.text}\n')
print(f'使用代理獲取 {url} 成功: \n{response.text}\n')
else:
print(f'使用代理獲取 {url} 失敗:\n{response.status_code}\n')
except Exception as e:
print(f'使用代理獲取 {url} 出錯:\n{e}\n')
except:
print(f'使用代理獲取 {url} 出現未知錯誤\n')

for url in urls:
try:
headersForCheck = dict(session.headers)
Expand Down

0 comments on commit 7a8102c

Please sign in to comment.