-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We have a new json.decoder.JSONDecodeError #11
Comments
Hi,
Try printing out what the response from the `requests.get()` call without
the `json()` conversion is on line 95 in share.py
`print(requests.get(url, headers=headers))`
What is it returning? It probably isn't JSON.
…On Mon, Jun 3, 2024 at 10:16 AM Fco. Javier Bermejo < ***@***.***> wrote:
If you try Example.py or other file.py you get this message:
Traceback (most recent call last):
File "C:\ProgramData\anaconda3\Lib\site-packages\requests\models.py", line
974, in json
return complexjson.loads(self.text, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\json_*init*_.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\json\decoder.py", line 355, in
raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Jan\Documents\Python Scripts\ScanTrade.py", line 90, in
symbol_data = my_share.get_historical(period_type, period_value,
frecuency_type, frecuency_value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Jan\Documents\Python Scripts\share.py", line 26, in
get_historical
data = self._download_symbol_data(period_type, period,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Jan\Documents\Python Scripts\share.py", line 95, in
_download_symbol_data
resp_json = requests.get(url, headers=headers).json()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\site-packages\requests\models.py", line
978, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1
(char 0)
any idea about it????
—
Reply to this email directly, view it on GitHub
<#11>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABCVGL2EEAFNTKY7KQLKVT3ZFSQFDAVCNFSM6AAAAABIW5ONKWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGMZTCNRWGU3TGOA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I edited 95 line and changed this line: by these other lines: The printed out is: <Response [429]> is it clear for you??? |
I fixed it.... 429 error from yahoo is for TOO MANY REQUESTS..... In share.py only change line: by this other and it works: |
They protect their service to some extent because there are many robots
trying to scrape the data all the time. Glad you figured it out.
…On Mon, Jun 3, 2024 at 11:44 AM FJB ***@***.***> wrote:
I fixed it....
429 error from yahoo is for TOO MANY REQUESTS.....
I don't know why buy something change in yahoo..... but it's easy to fix
it.
And I don't make too many requests.......
In share.py only change line:
headers = {'User-Agent': ''}
by this other and it works:
headers = {'User-Agent': 'your bot 0.1'}
—
Reply to this email directly, view it on GitHub
<#11 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABCVGL5CF6KSHFJ3A4N2KNDZFS2RZAVCNFSM6AAAAABIW5ONKWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBVHA4DSMRRGU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
If you try Example.py or other file.py you get this message:
Traceback (most recent call last):
File "C:\ProgramData\anaconda3\Lib\site-packages\requests\models.py", line 974, in json
return complexjson.loads(self.text, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Jan\Documents\Python Scripts\ScanTrade.py", line 90, in
symbol_data = my_share.get_historical(period_type, period_value, frecuency_type, frecuency_value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Jan\Documents\Python Scripts\share.py", line 26, in get_historical
data = self._download_symbol_data(period_type, period,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Jan\Documents\Python Scripts\share.py", line 95, in _download_symbol_data
resp_json = requests.get(url, headers=headers).json()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\site-packages\requests\models.py", line 978, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
any idea about it????
The text was updated successfully, but these errors were encountered: