Forums

HTTP Error 429: Too Many Requests

My site is throwing this error whenever I sent a request for something. This problem has started today. Pls provide me any suggestion or help.

What is the context of the error message? We need more details to help you.

I am using Pytube library in my project and after sometime it raises the error of HTTP 429 saying Too many request.

Could you investigate your code and check which calls are resulting in that error? How the requests are being made? What url are you trying to hit?

I simply import a library

 from pytube import YouTube
yt = YouTube('https://www.youtube.com/watch?v=tPEE9ZwTmy0')

and it start giving error about Too Many Requests

In my web app the error is

        Traceback (most recent call last):
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/downtube/DownTube/home/views.py", line 62, in index
    response = render(request,template,context={
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/shortcuts.py", line 24, in render
    content = loader.render_to_string(template_name, context, request, using=using)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/loader.py", line 62, in render_to_string
    return template.render(context, request)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/backends/django.py", line 62, in render
    return self.template.render(context)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 175, in render
    return self._render(context)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 167, in _render
    return self.nodelist.render(context)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 1000, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 1000, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 958, in render_annotated
    return self.render(context)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/loader_tags.py", line 157, in render
    return compiled_parent._render(context)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 167, in _render
    return self.nodelist.render(context)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 1000, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 1000, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 958, in render_annotated
    return self.render(context)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/loader_tags.py", line 63, in render
    result = block.nodelist.render(context)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 1000, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 1000, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 958, in render_annotated
    return self.render(context)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/defaulttags.py", line 238, in render
    nodelist.append(node.render_annotated(context))
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 958, in render_annotated
    return self.render(context)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/loader_tags.py", line 208, in render
    return template.render(context)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 177, in render
    return self._render(context)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 167, in _render
    return self.nodelist.render(context)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 1000, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 1000, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 958, in render_annotated
    return self.render(context)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 1059, in render
    output = self.filter_expression.resolve(context)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 712, in resolve
    obj = self.var.resolve(context)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 842, in resolve
    value = self._resolve_lookup(context)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/django/template/base.py", line 885, in _resolve_lookup
    current = getattr(current, bit)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/pytube/__main__.py", line 323, in publish_date
    self._publish_date = extract.publish_date(self.watch_html)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/pytube/__main__.py", line 102, in watch_html
    self._watch_html = request.get(url=self.watch_url)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/pytube/request.py", line 53, in get
    response = _execute_request(url, headers=extra_headers, timeout=timeout)
  File "/home/downtube/.virtualenvs/downtubeEnv/lib/python3.9/site-packages/pytube/request.py", line 37, in _execute_request
    return urlopen(request, timeout=timeout)  # nosec
  File "/usr/local/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.9/urllib/request.py", line 523, in open
    response = meth(req, response)
  File "/usr/local/lib/python3.9/urllib/request.py", line 632, in http_response
    response = self.parent.error(
  File "/usr/local/lib/python3.9/urllib/request.py", line 555, in error
    result = self._call_chain(*args)
  File "/usr/local/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.9/urllib/request.py", line 747, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/usr/local/lib/python3.9/urllib/request.py", line 523, in open
    response = meth(req, response)
  File "/usr/local/lib/python3.9/urllib/request.py", line 632, in http_response
    response = self.parent.error(
  File "/usr/local/lib/python3.9/urllib/request.py", line 561, in error
    return self._call_chain(*args)
  File "/usr/local/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.9/urllib/request.py", line 641, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 429: Too Many Requests

I believe we already replied you via email -- let's keep the conversation there.

hi I am having a similar issue

youtube is not on the list for free accounts.