Skip to content
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

403 in search_assets as well #67

Open
bertozzi opened this issue Oct 26, 2022 · 7 comments
Open

403 in search_assets as well #67

bertozzi opened this issue Oct 26, 2022 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@bertozzi
Copy link

from investiny import search_assets
search_results = search_assets(query="EUR/USD", limit=1, type="FX")
Traceback (most recent call last):
File "", line 1, in
File "/home/pi/.local/lib/python3.11/site-packages/investiny/search.py", line 42, in search_assets
return request_to_investing(endpoint="search", params=params) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/.local/lib/python3.11/site-packages/investiny/utils.py", line 36, in request_to_investing
raise ConnectionError(
ConnectionError: Request to Investing.com API failed with error code: 403.

@alvarobartt alvarobartt self-assigned this Oct 31, 2022
@alvarobartt alvarobartt added the bug Something isn't working label Oct 31, 2022
@alvarobartt
Copy link
Owner

Hi, @bertozzi so as far as I could check that happens whenever you send too many consecutive requests, so once you get blocked you'll have to wait up to 24 hours before sending another request to Investing.com... So I'd recommend you wait until you're no longer blocked so that you can use investiny as usually!

@bertozzi
Copy link
Author

bertozzi commented Nov 2, 2022

Got it. Anyway this is veeery limiting. Do you think it can be solved in the future?

@alvarobartt
Copy link
Owner

I know @bertozzi ... but that depends on Investing.com... I've contacted them already, but it's taking too long to escalate my proposal so I didn't receive an answer yet, just redirections to other teams...

@ChrizzBln89
Copy link

Hi @alvarobartt ,

I get the 403 Error everytime I excecute the following code:

from investiny import search_assets
search_results = search_assets(query="EUR/USD", limit=1, type="FX")

VS code give me this error Message:


ConnectionError Traceback (most recent call last)
Cell In [1], line 2
1 from investiny import search_assets
----> 2 search_results = search_assets(query="EUR/USD", limit=1, type="FX")

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\investiny\search.py:42, in search_assets(query, limit, type, exchange)
25 """Search any available asset at Investing.com.
26
27 Args:
(...)
34 A list of dictionaries with the search results from Investing.com.
35 """
36 params = {
37 "query": query,
38 "limit": limit,
39 "type": type if type else "",
40 "exchange": exchange if exchange else "",
41 }
---> 42 return request_to_investing(endpoint="search", params=params)

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\investiny\utils.py:36, in request_to_investing(endpoint, params)
34 r = httpx.get(url, params=params, headers=headers)
35 if r.status_code != 200:
---> 36 raise ConnectionError(
...
38 )
39 d = r.json()
41 if endpoint in ["history", "quotes"] and d["s"] != "ok":

ConnectionError: Request to Investing.com API failed with error code: 403.

[I did not request any data before from investing.com.]

Could you please help me with this one?

Best, Chris

@vbraguimcanto
Copy link

Hello @alvarobartt!

I have the same problem reported by @ChrizzBln89. I haven't made any previous requests, and mostly it's been weeks, but I keep getting a 403.

Any solution?

Thanks!

@lstavares84
Copy link

OK! Unfortunaly it's not work. I had waited for 3 day and keeps the same.
Change of computer, IP, from google colab, to jupyter to pycharm and not working.

@lstavares84
Copy link

pip install investiny
Requirement already satisfied: investiny in c:\programdata\anaconda3\lib\site-packages (0.7.2)
Requirement already satisfied: httpx<0.24.0,>=0.23.0 in c:\programdata\anaconda3\lib\site-packages (from investiny) (0.23.1)
Requirement already satisfied: pydantic<2.0.0,>=1.10.2 in c:\programdata\anaconda3\lib\site-packages (from investiny) (1.10.2)
Requirement already satisfied: rfc3986[idna2008]<2,>=1.3 in c:\programdata\anaconda3\lib\site-packages (from httpx<0.24.0,>=0.23.0->investiny) (1.5.0)
Requirement already satisfied: sniffio in c:\programdata\anaconda3\lib\site-packages (from httpx<0.24.0,>=0.23.0->investiny) (1.2.0)
Requirement already satisfied: httpcore<0.17.0,>=0.15.0 in c:\programdata\anaconda3\lib\site-packages (from httpx<0.24.0,>=0.23.0->investiny) (0.16.1)
Requirement already satisfied: certifi in c:\programdata\anaconda3\lib\site-packages (from httpx<0.24.0,>=0.23.0->investiny) (2022.6.15)
Requirement already satisfied: typing-extensions>=4.1.0 in c:\programdata\anaconda3\lib\site-packages (from pydantic<2.0.0,>=1.10.2->investiny) (4.3.0)
Requirement already satisfied: anyio<5.0,>=3.0 in c:\programdata\anaconda3\lib\site-packages (from httpcore<0.17.0,>=0.15.0->httpx<0.24.0,>=0.23.0->investiny) (3.5.0)
Requirement already satisfied: h11<0.15,>=0.13 in c:\programdata\anaconda3\lib\site-packages (from httpcore<0.17.0,>=0.15.0->httpx<0.24.0,>=0.23.0->investiny) (0.14.0)
Requirement already satisfied: idna in c:\programdata\anaconda3\lib\site-packages (from rfc3986[idna2008]<2,>=1.3->httpx<0.24.0,>=0.23.0->investiny) (3.3)
Note: you may need to restart the kernel to use updated packages.
from investiny import historical_data

data = historical_data(investing_id=6408, from_date="09/01/2022", to_date="10/01/2022") # Returns AAPL historical data as JSON (without date
---------------------------------------------------------------------------

ConnectionError                           Traceback (most recent call last)

~\AppData\Local\Temp\ipykernel_5480\3995262710.py in <module>
      1 from investiny import historical_data
      2 
----> 3 data = historical_data(investing_id=6408, from_date="09/01/2022", to_date="10/01/2022") # Returns AAPL historical data as JSON (without date


C:\ProgramData\Anaconda3\lib\site-packages\investiny\historical.py in historical_data(investing_id, from_date, to_date, interval)
     46     )
     47 
---> 48     info = investing_info(investing_id=investing_id)
     49 
     50     has_volume = not info["has_no_volume"]


C:\ProgramData\Anaconda3\lib\site-packages\investiny\info.py in investing_info(investing_id)
     39         A dictionary with the asset's information used internally by Investing.com.
     40     """
---> 41     return request_to_investing(  # type: ignore
     42         endpoint="symbols",
     43         params={"symbol": investing_id},


C:\ProgramData\Anaconda3\lib\site-packages\investiny\utils.py in request_to_investing(endpoint, params)
     34     r = httpx.get(url, params=params, headers=headers)
     35     if r.status_code != 200:
---> 36         raise ConnectionError(
     37             f"Request to Investing.com API failed with error code: {r.status_code}."
     38         )


ConnectionError: Request to Investing.com API failed with error code: 403.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants