test working
This commit is contained in:
@@ -1,9 +1,33 @@
|
||||
from django.contrib import admin
|
||||
from import_export.admin import ImportExportModelAdmin
|
||||
from .models import streamingData
|
||||
from .utils import full_testing
|
||||
|
||||
|
||||
# Register your models here.
|
||||
|
||||
@admin.action(description="check the URLs")
|
||||
def check(modeladmin, request, queryset):
|
||||
for query in queryset:
|
||||
print(query)
|
||||
website_url = query.url
|
||||
status=full_testing(website_url)
|
||||
print(status)
|
||||
query.status = status
|
||||
query.save(update_fields=["status"])
|
||||
|
||||
|
||||
# modeladmin.message_user(
|
||||
# request,
|
||||
# ngettext(
|
||||
# "%d episode was successfully marked as seen.",
|
||||
# "%d episodes were successfully marked as seen.",
|
||||
# updated,
|
||||
# )
|
||||
# % updated,
|
||||
# messages.SUCCESS,
|
||||
# )
|
||||
|
||||
@admin.register(streamingData)
|
||||
class streamingAdmin(ImportExportModelAdmin):
|
||||
list_display = [field.name for field in streamingData._meta.fields if field.name != 'id']
|
||||
list_display = [field.name for field in streamingData._meta.fields if field.name != 'id']
|
||||
actions = [check]
|
||||
@@ -1,8 +1,19 @@
|
||||
import requests
|
||||
from django.conf import settings
|
||||
import sys
|
||||
|
||||
|
||||
def full_testing(url_website):
|
||||
status = "unknown"
|
||||
|
||||
#step 1 : test without VPN
|
||||
status = test_website(url_website)
|
||||
|
||||
|
||||
#step 2 : test with VPN
|
||||
#if status != 200:
|
||||
# status = test_website(url_website,bool_proxy=True)
|
||||
|
||||
return status
|
||||
|
||||
|
||||
def test_website(url_website,bool_proxy=False):
|
||||
|
||||
Reference in New Issue
Block a user