add a result for the method of use
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2s
This commit is contained in:
@@ -9,11 +9,12 @@ from .utils import full_testing
|
||||
def check(modeladmin, request, queryset):
|
||||
for query in queryset:
|
||||
website_url = query.url
|
||||
status=full_testing(website_url)
|
||||
print(query.url)
|
||||
print(status)
|
||||
status=full_testing(website_url)[0]
|
||||
result= full_testing(website_url)[1]
|
||||
print(str(query.url)+": "+str(status)+" -> "+str(result))
|
||||
query.status = status
|
||||
query.save(update_fields=["status"])
|
||||
query.result = result
|
||||
query.save(update_fields=["status","result"])
|
||||
|
||||
|
||||
# modeladmin.message_user(
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.2.30 on 2026-08-05 13:44
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('streaming', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='streamingdata',
|
||||
name='result',
|
||||
field=models.CharField(blank=True, max_length=1000, null=True),
|
||||
),
|
||||
]
|
||||
@@ -5,6 +5,7 @@ class streamingData(models.Model):
|
||||
url = models.CharField(max_length=1000)
|
||||
addedDate = models.DateField('Published', blank=True, null=True, auto_now_add=True)
|
||||
status = models.CharField(max_length=1000, blank=True, null=True)
|
||||
result = models.CharField(max_length=1000, blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
db_table = 'streaming'
|
||||
|
||||
@@ -8,12 +8,17 @@ def full_testing(url_website):
|
||||
#step 1 : test without VPN
|
||||
status = test_website(url_website)
|
||||
|
||||
|
||||
#step 2 : test with VPN
|
||||
if status != 200:
|
||||
if status == 200:
|
||||
result = "REACHABLE"
|
||||
else:
|
||||
#step 2 : test with VPN
|
||||
status = test_website(url_website,bool_proxy=True)
|
||||
if status != 200:
|
||||
result = "UNREACHABLE"
|
||||
else:
|
||||
result = "VPN REQUIRED"
|
||||
|
||||
return status
|
||||
return status,result
|
||||
|
||||
|
||||
def test_website(url_website,bool_proxy=False):
|
||||
|
||||
Reference in New Issue
Block a user