gleitz / howdoi

instant coding answers via the command line
http://blog.gleitzman.com/post/43330157197/howdoi-instant-coding-answers-via-the-command-line
MIT License
10.56k stars 867 forks source link

403 forbiddeb #492

Open intrepidsilence opened 6 months ago

intrepidsilence commented 6 months ago

What happened:

When running with any query it fails with a pool.py 403 forbidden error.

❯ howdoi format date bash
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.12/3.12.1_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
                    ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.1_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/pool.py", line 51, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/howdoi/2.0.20_6/libexec/lib/python3.12/site-packages/howdoi/howdoi.py", line 461, in _get_answer_worker
    answer = _get_answer(args, link)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/howdoi/2.0.20_6/libexec/lib/python3.12/site-packages/howdoi/howdoi.py", line 359, in _get_answer
    page = _get_result(link + '?answertab=votes')
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/howdoi/2.0.20_6/libexec/lib/python3.12/site-packages/howdoi/howdoi.py", line 183, in _get_result
    resp.raise_for_status()
  File "/opt/homebrew/Cellar/howdoi/2.0.20_6/libexec/lib/python3.12/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://stackoverflow.com/questions/1401482/yyyy-mm-dd-format-date-in-shell-script?answertab=votes
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/homebrew/bin/howdoi", line 8, in <module>
    sys.exit(command_line_runner())
             ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/howdoi/2.0.20_6/libexec/lib/python3.12/site-packages/howdoi/howdoi.py", line 814, in command_line_runner
    howdoi_result = howdoi(args)
                    ^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/howdoi/2.0.20_6/libexec/lib/python3.12/site-packages/howdoi/howdoi.py", line 632, in howdoi
    res = _get_answers(args)
          ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/howdoi/2.0.20_6/libexec/lib/python3.12/site-packages/howdoi/howdoi.py", line 446, in _get_answers
    answers = pool.starmap(
              ^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.1_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/pool.py", line 375, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.1_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/pool.py", line 774, in get
    raise self._value
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://stackoverflow.com/questions/1401482/yyyy-mm-dd-format-date-in-shell-script?answertab=votes

What you expected to happen:

get a valid result

Output with --explain

howdoi format date bash --explain
INFO: Version: 2.0.20
INFO: Fetching answers for query: format date bash
INFO: Using cached links
INFO: Links from stackoverflow.com found on google: 1
INFO: URL: https://stackoverflow.com/questions/1401482/yyyy-mm-dd-format-date-in-shell-script
INFO: Answers requested: 1, Starting at position: 1
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.12/3.12.1_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
                    ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.1_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/pool.py", line 51, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/howdoi/2.0.20_6/libexec/lib/python3.12/site-packages/howdoi/howdoi.py", line 461, in _get_answer_worker
    answer = _get_answer(args, link)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/howdoi/2.0.20_6/libexec/lib/python3.12/site-packages/howdoi/howdoi.py", line 359, in _get_answer
    page = _get_result(link + '?answertab=votes')
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/howdoi/2.0.20_6/libexec/lib/python3.12/site-packages/howdoi/howdoi.py", line 183, in _get_result
    resp.raise_for_status()
  File "/opt/homebrew/Cellar/howdoi/2.0.20_6/libexec/lib/python3.12/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://stackoverflow.com/questions/1401482/yyyy-mm-dd-format-date-in-shell-script?answertab=votes
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/homebrew/bin/howdoi", line 8, in <module>
    sys.exit(command_line_runner())
             ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/howdoi/2.0.20_6/libexec/lib/python3.12/site-packages/howdoi/howdoi.py", line 814, in command_line_runner
    howdoi_result = howdoi(args)
                    ^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/howdoi/2.0.20_6/libexec/lib/python3.12/site-packages/howdoi/howdoi.py", line 632, in howdoi
    res = _get_answers(args)
          ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/howdoi/2.0.20_6/libexec/lib/python3.12/site-packages/howdoi/howdoi.py", line 446, in _get_answers
    answers = pool.starmap(
              ^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.1_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/pool.py", line 375, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.1_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/pool.py", line 774, in get
    raise self._value
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://stackoverflow.com/questions/1401482/yyyy-mm-dd-format-date-in-shell-script?answertab=votes
renatocfrancisco commented 4 months ago

@intrepidsilence my terminal didn't throw an error. have you tried uninstalling it? is it working now? issue solved? WindowsTerminal_KXbbtpCA7g

intrepidsilence commented 4 months ago

Seems to be working now. Not sure what changed. Thanks