Benzinga / benzinga-python-client

Python client library for benzinga news and financial data
https://cloud.benzinga.com
MIT License
22 stars 12 forks source link

Issues tryin to run: pip install git+ssh://git@github.com/Benzinga/benzinga-python-client.git #16

Open JorgeFBock opened 5 months ago

JorgeFBock commented 5 months ago

Can somebody help me understand this:

Collecting git+ssh://@github.com/Benzinga/benzinga-python-client.git Cloning ssh://@github.com/Benzinga/benzinga-python-client.git to /tmp/pip-req-build-bvbdj9ei Running command git clone --filter=blob:none --quiet 'ssh://****@github.com/Benzinga/benzinga-python-client.git' /tmp/pip-req-build-bvbdj9ei

Host key verification failed. fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists. error: subprocess-exited-with-error

× git clone --filter=blob:none --quiet 'ssh://****@github.com/Benzinga/benzinga-python-client.git' /tmp/pip-req-build-bvbdj9ei did not run successfully. │ exit code: 128 ╰─> See above for output.

k-bala-vignesh commented 3 months ago

Here's what worked for me. Step 1: git clone https://github.com/Benzinga/benzinga-python-client.git Step 2: Rename the dir as benzinga instead of benzinga-python-client Step 3: In your python script, add these lines

import sys
sys.path.append("/path/to/benzinga")

Step 4: Now, slightly modify the import in the example. Use benzinga instead of benzingaorg

from benzinga import financial_data
api_key = "your api key here"
fin = financial_data.Benzinga(api_key)
stock_ratings = fin.ratings()
CBrauer commented 1 month ago

Hello Benzinga. I'm trying to install and run your test script, without success. My environment is:

  1. Windows 11, Version 10.0.22631 Build 22631
  2. Anaconda Python.

I followed the instructions at https://pypi.org/project/benzinga/.

Here are my results:


H:\HedgeTools>pip install benzinga
DEPRECATION: Loading egg at h:\anaconda3\lib\site-packages\ibapi-10.19.2-py3.11.egg is deprecated. pip 24.3 will enforce
 this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
Collecting benzinga
  Downloading benzinga-1.21.tar.gz (10 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: requests in h:\anaconda3\lib\site-packages (from benzinga) (2.31.0)
Collecting structlog (from benzinga)
  Downloading structlog-24.2.0-py3-none-any.whl.metadata (7.9 kB)
Collecting urllib3==1.25.10 (from benzinga)
  Downloading urllib3-1.25.10-py2.py3-none-any.whl.metadata (40 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.5/40.5 kB 658.2 kB/s eta 0:00:00
Requirement already satisfied: charset-normalizer<4,>=2 in h:\anaconda3\lib\site-packages (from requests->benzinga) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in h:\anaconda3\lib\site-packages (from requests->benzinga) (3.7)
Requirement already satisfied: certifi>=2017.4.17 in h:\anaconda3\lib\site-packages (from requests->benzinga) (2024.2.2)
Downloading urllib3-1.25.10-py2.py3-none-any.whl (127 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 127.6/127.6 kB 2.6 MB/s eta 0:00:00
Downloading structlog-24.2.0-py3-none-any.whl (65 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.8/65.8 kB ? eta 0:00:00
Building wheels for collected packages: benzinga
  Building wheel for benzinga (setup.py) ... done
  Created wheel for benzinga: filename=benzinga-1.21-py3-none-any.whl 
  size=12237 sha256=e1634eabded1fa49d1ab9470d0f5533efa80e88fd856dd09d864316389661717
  Stored in directory: c:\users\cbrau\appdata\local\pip\cache\wheels\7c\ed\9c\6e3cdc5572306240ccfa78b7db80827a3a802de1824c4a2d2b
Successfully built benzinga
Installing collected packages: urllib3, structlog, benzinga
  Attempting uninstall: urllib3
    Found existing installation: urllib3 2.2.1
    Uninstalling urllib3-2.2.1:
      Successfully uninstalled urllib3-2.2.1
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. 
This behaviour is the source of the following dependency conflicts.
anaconda-client 1.12.3 requires urllib3>=1.26.4, but you have urllib3 1.25.10 which is incompatible.
selenium 4.21.0 requires urllib3[socks]<3,>=1.26, but you have urllib3 1.25.10 which is incompatible.
Successfully installed benzinga-1.21 structlog-24.2.0 urllib3-1.25.10

H:\HedgeTools>python
Python 3.11.8 | packaged by conda-forge | (main, Feb 16 2024, 20:40:50) [MSC v.1937 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from benzinga import financial_data
>>> api_key = "bcd3f685994741e1b41cbd80cc57a8f2"
>>> fin = financial_data.Benzinga(api_key)
>>> stock_ratings = fin.ratings()
2024-06-05 08:23:38 [info     ] 
Status Code: 401 Endpoint: https://api.benzinga.com/api/v2/calendar/ratings?token=bcd3f685994741e1b41cbd80cc57a8f2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "H:\anaconda3\Lib\site-packages\benzinga\financial_data.py", line 511, in ratings
    self.__check_status(ratings.status_code)
  File "H:\anaconda3\Lib\site-packages\benzinga\financial_data.py", line 83, in __check_status
    raise TokenAuthenticationError
benzinga.benzinga_errors.TokenAuthenticationError: Error Message: Something went wrong. Please again try again later

Any help will be appreciated. Charles

wijowa commented 1 month ago

Hi @CBrauer it looks like you will need to get an api key. Have you signed up on the form at https://www.benzinga.com/apis/?

CBrauer commented 1 month ago

Yes, I did, and I got the following key:

benzinga key

Charles

MichaelOwenDyer commented 1 month ago

@CBrauer Friendly tip: an API key is like a username and password, you should never share it publicly! I would strongly recommend deactivating that key and creating a new one for yourself :)

aveshd commented 2 weeks ago

if you are on wiondows environemnt try running pip install git+https://git@github.com/Benzinga/benzinga-python-client.git. Notice ssh verses https. this worked for me