Bug 494023 - Downloading values from yahoo fails HTTP Error 401: Unauthorized
Summary: Downloading values from yahoo fails HTTP Error 401: Unauthorized
Status: RESOLVED FIXED
Alias: None
Product: skrooge
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: 25.1.0
Assignee: Stephane MANKOWSKI
URL:
Keywords:
: 495425 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-10-03 08:43 UTC by Christoph Vogtländer
Modified: 2024-10-30 06:23 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Vogtländer 2024-10-03 08:43:12 UTC
SUMMARY
Running skrooge-yahoodl.py results in HTTP Error 401: Unauthorized

STEPS TO REPRODUCE
1. execute /usr/share/skrooge/skrooge-yahoodl.py EURUSD=X 2024-09-17 2024-10-03 1d

OBSERVED RESULT
Traceback (most recent call last):
  File "/usr/share/skrooge/skrooge-yahoodl.py", line 110, in <module>
    for l in load_yahoo_quote(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4]):
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/skrooge/skrooge-yahoodl.py", line 105, in load_yahoo_quote
    f = urllib.request.urlopen(url)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 215, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 521, in open
    response = meth(req, response)
               ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 630, in http_response
    response = self.parent.error(
               ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 559, in error
    return self._call_chain(*args)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 492, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 639, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 401: Unauthorized

EXPECTED RESULT
Quotes should be fetched

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.1.5
KDE Frameworks Version: 6.6.0
Qt Version: 6.7.3
Kernel Version: 6.10.10-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i5-4460 CPU @ 3.20GHz
Memory: 15.3 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 4600

ADDITIONAL INFORMATION
Comment 1 Stephane MANKOWSKI 2024-10-03 18:04:33 UTC
Hi,

Yahoo doesn't allow anymore to download.
I removed this source and added a new one from boursorama.
See https://invent.kde.org/office/skrooge/-/commit/5758d908b5918401a0e75b17b1d23253fb12272a

So, this ticket is closed.
Comment 2 Stephane MANKOWSKI 2024-10-27 12:15:42 UTC
*** Bug 495425 has been marked as a duplicate of this bug. ***
Comment 3 archideb 2024-10-28 07:30:07 UTC
Hello, i have problem with plugin boursorama:
/usr/share/skrooge/skrooge-boursorama.py IRE.MI

Traceback (most recent call last):

File "/usr/share/skrooge/skrooge-boursorama.py", line 138, in <module>

from_date = date.fromisoformat(sys.argv[2])

~~~~~~~~^^^
Comment 4 Stephane MANKOWSKI 2024-10-28 22:22:31 UTC
With a good code and date and duration, this is working:
/usr/share/skrooge/skrooge-boursorama.py AIRBUS 2024-10-22 1d
Comment 5 archideb 2024-10-29 05:57:02 UTC
Hello, this is error:

/usr/share/skrooge/skrooge-boursorama.py AIRBUS 2024-10-22 1d
date,price
Traceback (most recent call last):
  File "/usr/share/skrooge/skrooge-boursorama.py", line 143, in <module>
    dump_to_csv(symbol, results, sys.stdout)
  File "/usr/share/skrooge/skrooge-boursorama.py", line 132, in dump_to_csv
    for value in ticker_values:
                 ^^^^^^^^^^^^^
  File "/usr/share/skrooge/skrooge-boursorama.py", line 116, in download_history
    earliest_date = yield from parse_one_page(soup, start_date)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/skrooge/skrooge-boursorama.py", line 100, in parse_one_page
    with override_locale(locale.LC_NUMERIC, "fr_FR.UTF-8"):
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/usr/share/skrooge/skrooge-boursorama.py", line 71, in override_locale
    locale.setlocale(category, locale_string)
  File "/usr/lib/python3.12/locale.py", line 615, in setlocale
    return _setlocale(category, locale)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
locale.Error: unsupported locale setting
Comment 6 Stephane MANKOWSKI 2024-10-29 22:31:28 UTC
Git commit 1d8da82a4ba6c4d59ee24785e261d232cbf1edbc by Stephane MANKOWSKI.
Committed on 29/10/2024 at 22:31.
Pushed by smankowski into branch 'master'.

Downloading values from yahoo fails HTTP Error 401: Unauthorized

M  +1    -0    CHANGELOG
M  +7    -16   skgbankmodeler/skrooge-boursorama.py

https://invent.kde.org/office/skrooge/-/commit/1d8da82a4ba6c4d59ee24785e261d232cbf1edbc
Comment 7 archideb 2024-10-30 06:23:34 UTC
(In reply to Stephane MANKOWSKI from comment #6)
> Git commit 1d8da82a4ba6c4d59ee24785e261d232cbf1edbc by Stephane MANKOWSKI.
> Committed on 29/10/2024 at 22:31.
> Pushed by smankowski into branch 'master'.
> 
> Downloading values from yahoo fails HTTP Error 401: Unauthorized
> 
> M  +1    -0    CHANGELOG
> M  +7    -16   skgbankmodeler/skrooge-boursorama.py
> 
> https://invent.kde.org/office/skrooge/-/commit/
> 1d8da82a4ba6c4d59ee24785e261d232cbf1edbc

Good job! The plugin now works correctly both on the command line and within Skrooge. Thank you for your kind availability.