|
@@ -1,10 +1,22 @@
|
|
|
-from django.shortcuts import render
|
|
|
+import requests
|
|
|
+
|
|
|
+from bs4 import BeautifulSoup
|
|
|
from django.http import HttpResponse
|
|
|
|
|
|
|
|
|
-def base_good(request):
|
|
|
+def base(request):
|
|
|
return HttpResponse("<h1> Base views: Response - 200_OK </h1>")
|
|
|
|
|
|
|
|
|
-def base_bad(request):
|
|
|
- return HttpResponse("<h1> Base views: Response - 404_Not_Found<br>Ah shit, here we go again...</h1>")
|
|
|
+def base_info(request):
|
|
|
+ return HttpResponse("<h1> Info views: Response - 200_OK<br>Mironov Misha</h1>")
|
|
|
+
|
|
|
+
|
|
|
+def status_output(request):
|
|
|
+ response = requests.get(url='https://2ip.ru/')
|
|
|
+ bs = BeautifulSoup(response.text, "lxml")
|
|
|
+ ip = bs.find('div', 'ip')
|
|
|
+
|
|
|
+ return HttpResponse(
|
|
|
+ f"<h1> IP: {ip.text} </h1><br><h3>Для безопасности изменены последние 2 числа (после точек)</h3>"
|
|
|
+ )
|