*************** Код в моем файле views.py ************
import requests
from django.shortcuts import render
from bs4 import BeautifulSoup
BASE_CRAIGSLIST_URL = 'https://sanantonio.craigslist.org/search/bbb?query={}'
# Create your views here.
def home(request):
return render(request, 'base.html')
def new_search(request):
search = request.POST.get('search')
response = requests.get('https://sanantonio.craigslist.org/search/bbb?query=python%20tutor&sort=rel', verify=False)
data = response.text
print(data)
stuff_for_frontend = {
'search': search,
}
return render(request, 'my_app/new_search.html', stuff_for_frontend)
**** ***** ЗАПРОСИТЕ URL - МОЙ IP - АДРЕС, если я этого не уточнил ******** Это ошибка соединения, которую я получаю
ConnectionError at /new_search
HTTPSConnectionPool(host='sanantonio.craigslist.org', port=443): Max retries exceeded with url: /search/bbb?query=python%20tutor&sort=rel (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f184c3d36a0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))
Request Method: GET
Request URL: http://"IP-Address:8000"/new_search
Django Version: 3.0.5
Exception Type: ConnectionError
Exception Value:
HTTPSConnectionPool(host='sanantonio.craigslist.org', port=443): Max retries exceeded with url: /search/bbb?query=python%20tutor&sort=rel (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f184c3d36a0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))
Exception Location: /home/alecsoliz/django-apps/env/lib/python3.6/site-packages/requests/adapters.py in send, line 516
Python Executable: /home/alecsoliz/django-apps/env/bin/python
Python Version: 3.6.9
Python Path:
['/home/alecsoliz/django-apps/webscraping_app',
'/usr/lib/python36.zip',
'/usr/lib/python3.6',
'/usr/lib/python3.6/lib-dynload',
'/home/alecsoliz/django-apps/env/lib/python3.6/site-packages']
Server time: Thu, 23 Apr 2020 10:17:55 +0000