0

I was creating a infinite loop with html-requests I was wondering if I have to close the session when ever I use the get method

def get_data(url):
    while True:
        try:
            global links_gastados
            if links_gastados.size==soporte_cache:
                links_gastados=np.array([])
            global archivo
            separados=archivo[0].split(":")
            datos_proxy="socks5://"+separados[2]+":"+separados[3]+":"+separados[0]+":"+separados[1]
            proxy={"sock5": datos_proxy}
            r = s.get(url,proxies=proxy)
            r.html.render(sleep=sleep_v)
            links=r.html.absolute_links
            for link in links:
                if "0x" in link:
                    if "assets" in link:
                        if "matic" not in link:
                            if link not in links_gastados:
                                hook.send(link)
                                links_gastados=np.append(links_gastados,link)
            
        except:

            archivo=archivo[1:]
Tanish Sarmah
  • 394
  • 3
  • 14
Ismael
  • 59
  • 7
  • 1
    [No.](https://stackoverflow.com/questions/10115126/python-requests-close-http-connection) Requests takes care of that for you. – Ezra Jun 29 '21 at 17:47

0 Answers0