Bug 439494 - Downloading currency using skrooge-yahoodl.py fails with UnicodeDecodeError
Summary: Downloading currency using skrooge-yahoodl.py fails with UnicodeDecodeError
Status: RESOLVED FIXED
Alias: None
Product: skrooge
Classification: Applications
Component: general (show other bugs)
Version: 2.25.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Stephane MANKOWSKI
URL:
Keywords:
: 440129 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-07-04 21:41 UTC by Christoph Vogtländer
Modified: 2021-07-22 18:13 UTC (History)
2 users (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 2021-07-04 21:41:51 UTC
SUMMARY
Downloading currency using skrooge-yahoodl.py fails with UnicodeDecodeError

STEPS TO REPRODUCE
1. Create a currency
2. Set Source to Yahoo, set code to e.g. ^DJI
3. Click "Download"
alternatively run
/usr/share/skrooge/skrooge-yahoodl.py ^DJI 2021-06-29 2021-07-04 1d
directly

OBSERVED RESULT
Traceback (most recent call last):
  File "/usr/share/skrooge/skrooge-yahoodl.py", line 127, 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 97, in load_yahoo_quote
    _get_cookie_crumb(ticker)
  File "/usr/share/skrooge/skrooge-yahoodl.py", line 69, in _get_cookie_crumb
    alines = f.read().decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

EXPECTED RESULT
Date,Open,High,Low,Close,Adj Close,Volume
2021-07-02,34642.421875,34821.929688,34613.488281,34786.351563,34786.351563,301860000
2021-07-01,34507.320313,34640.281250,34498.851563,34633.531250,34633.531250,268280000
2021-06-30,34290.738281,34553.160156,34245.480469,34502.511719,34502.511719,295560000
2021-06-29,34338.890625,34469.828125,34266.828125,34292.289063,34292.289063,282360000
2021-06-28,34428.101563,34449.648438,34186.128906,34283.269531,34283.269531,280280000


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

ADDITIONAL INFORMATION
It seems that Yahoo now returns gzipped data.
Comment 1 Bug Janitor Service 2021-07-04 22:02:49 UTC
A possibly relevant merge request was started @ https://invent.kde.org/office/skrooge/-/merge_requests/9
Comment 2 Stephane MANKOWSKI 2021-07-21 14:08:08 UTC
Git commit a96ee5bffffc09e00e96be5610275614fa2e14d4 by Stephane MANKOWSKI.
Committed on 21/07/2021 at 14:07.
Pushed by smankowski into branch 'master'.

Downloading currency using skrooge-yahoodl.py fails with UnicodeDecodeError

M  +6    -2    skgbankmodeler/skrooge-yahoodl.py

https://invent.kde.org/office/skrooge/commit/a96ee5bffffc09e00e96be5610275614fa2e14d4
Comment 3 Stephane MANKOWSKI 2021-07-22 18:13:28 UTC
*** Bug 440129 has been marked as a duplicate of this bug. ***