The_Alireza
The_Alireza

Reputation: 1

Requests timeout erro

I write this code and it has "timeout error". I have tried many solutions but the problem isnt solved. This is my code:

import requests
from pytube import YouTube

save_path = "C:/Desktop"

link = "https://youtu.be/A54_QPXdkU0"

responce = requests.get(link, timeout=10)
video = YouTube(responce)
stream = video.streams.get_audio_only()
stream.download(output_path = save_path)

error:

requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='youtu.be', port=443): Max retries exceeded with url: /A54_QPXdkU0 (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x0000019246A7F460>, 'Connection to youtu.be timed out. (connect timeout=10)'))

I write any number and "None" for timeout but the problem wasnt solved.

Pleas help me for solve this problem.

Thankyou

Upvotes: 0

Views: 137

Answers (1)

Hamza
Hamza

Reputation: 133

This thing usually happens when you send too many requests to the public IP address. You have to wait for some time and then try again.

Upvotes: 0

Related Questions