I was making a simple django application in which it will lookup to 
google.com and display all the links. Here's some of the code( that's 
causing the error ):

from django.shortcuts import render, HttpResponse
import requests
from bs4 import BeautifulSoup

def scrape(request):

    page = requests.get('https://wwww.google.com')
    soup = BeautifulSoup(page.text, 'html.parser')
    ...

When I try to run the local Django server and open localhost:8000 I get 
this error:

*ConnectionError at / *

*HTTPSConnectionPool(host='wwww.google.com',*
*port=443): Max retries exceeded with url: / (Caused by*
*NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object*
*at 0x056BFB50>: Failed to establish a new connection: [Errno 11001]*
*getaddrinfo failed'))*

On the other hand, if I try running `page = 
requests.get("https://www.google.com";)` on a python shell in the command 
prompt, it works fine with no errors. 

I tried to use `time.sleep` as it was mentioned in some SE answer but that 
did not help. So how should I go about fixing this?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7353725f-ae5c-4756-9cf3-67e1e1dfc449%40googlegroups.com.

Reply via email to