status-checker 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- status_checker/__init__.py +0 -0
- status_checker/admin.py +3 -0
- status_checker/apps.py +6 -0
- status_checker/forms.py +4 -0
- status_checker/migrations/__init__.py +0 -0
- status_checker/models.py +3 -0
- status_checker/tests.py +3 -0
- status_checker/urls.py +6 -0
- status_checker/views.py +30 -0
- status_checker-0.1.0.dist-info/METADATA +25 -0
- status_checker-0.1.0.dist-info/RECORD +13 -0
- status_checker-0.1.0.dist-info/WHEEL +5 -0
- status_checker-0.1.0.dist-info/top_level.txt +1 -0
File without changes
|
status_checker/admin.py
ADDED
status_checker/apps.py
ADDED
status_checker/forms.py
ADDED
File without changes
|
status_checker/models.py
ADDED
status_checker/tests.py
ADDED
status_checker/urls.py
ADDED
status_checker/views.py
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
from django.shortcuts import render
|
2
|
+
import requests
|
3
|
+
import time
|
4
|
+
from .forms import URLForm
|
5
|
+
|
6
|
+
def check_site_status(url):
|
7
|
+
try:
|
8
|
+
start = time.time()
|
9
|
+
response = requests.get(url, timeout=5)
|
10
|
+
duration = round((time.time() - start) * 1000) # ms
|
11
|
+
return {
|
12
|
+
"status_code": response.status_code,
|
13
|
+
"response_time": duration,
|
14
|
+
"online": response.status_code == 200
|
15
|
+
}
|
16
|
+
except requests.exceptions.RequestException:
|
17
|
+
return {
|
18
|
+
"status_code": None,
|
19
|
+
"response_time": None,
|
20
|
+
"online": False
|
21
|
+
}
|
22
|
+
|
23
|
+
def index(request):
|
24
|
+
result = None
|
25
|
+
form = URLForm(request.POST or None)
|
26
|
+
if form.is_valid():
|
27
|
+
url = form.cleaned_data["url"]
|
28
|
+
result = check_site_status(url)
|
29
|
+
result["url"] = url
|
30
|
+
return render(request, "site_status_checker/index.html", {"form": form, "result": result})
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: status_checker
|
3
|
+
Version: 0.1.0
|
4
|
+
Summary: Un petit package Django qui ckeck a disponibilite des pages web
|
5
|
+
Author: ynaffit_aes
|
6
|
+
Author-email: aramsamb02@gmail.com
|
7
|
+
License: MIT
|
8
|
+
Classifier: Environment :: Web Environment
|
9
|
+
Classifier: Framework :: Django
|
10
|
+
Classifier: Framework :: Django :: 4.0
|
11
|
+
Classifier: Framework :: Django :: 5.0
|
12
|
+
Classifier: Intended Audience :: Developers
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
14
|
+
Classifier: Programming Language :: Python
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
16
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
17
|
+
Description-Content-Type: text/markdown
|
18
|
+
Requires-Dist: django>=4.0
|
19
|
+
Dynamic: author
|
20
|
+
Dynamic: author-email
|
21
|
+
Dynamic: classifier
|
22
|
+
Dynamic: description-content-type
|
23
|
+
Dynamic: license
|
24
|
+
Dynamic: requires-dist
|
25
|
+
Dynamic: summary
|
@@ -0,0 +1,13 @@
|
|
1
|
+
status_checker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
status_checker/admin.py,sha256=suMo4x8I3JBxAFBVIdE-5qnqZ6JAZV0FESABHOSc-vg,63
|
3
|
+
status_checker/apps.py,sha256=LcdGYYts_3C8R0X4NMktutxoxWdXowaqff8L95OJX4o,159
|
4
|
+
status_checker/forms.py,sha256=CT0QWEmYnEnYmlCsqIYM7_wM_ADAqswVy23InYo8yt8,176
|
5
|
+
status_checker/models.py,sha256=Vjc0p2XbAPgE6HyTF6vll98A4eDhA5AvaQqsc4kQ9AQ,57
|
6
|
+
status_checker/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2nk6VY-g,60
|
7
|
+
status_checker/urls.py,sha256=CedaNDbhj_fbimWKSaZZ8fm7ehN6oy-2RZhFrOtNupM,112
|
8
|
+
status_checker/views.py,sha256=fVCF9NgJ3tBWNuY5DWCWaLbKvbWj8nMt0q4hqqQHVbg,909
|
9
|
+
status_checker/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
+
status_checker-0.1.0.dist-info/METADATA,sha256=lSTu8A5qfZJi1m3643eslGFCMEtWabsEFBaLQhJ1tPA,797
|
11
|
+
status_checker-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
12
|
+
status_checker-0.1.0.dist-info/top_level.txt,sha256=t0NxtwRcbJS71cfxuf-Co6w-hJyvK1BcmNM4givbsz4,15
|
13
|
+
status_checker-0.1.0.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
status_checker
|