{"id":23352,"library":"benzinga","title":"Benzinga Python Client","description":"Python client library for Benzinga Data API (financial data). Current version 1.21. Active development on GitHub.","status":"active","version":"1.21","language":"python","source_language":"en","source_url":"https://github.com/Benzinga/benzinga-python-client","tags":["financial","api","benzinga","stock-data"],"install":[{"cmd":"pip install benzinga","lang":"bash","label":"Install latest"}],"dependencies":[{"reason":"HTTP client for API calls","package":"requests","optional":false},{"reason":"Optional for DataFrame outputs when using data() method with format='pandas'","package":"pandas","optional":true}],"imports":[{"note":"Top-level import. No submodule required for basic usage.","symbol":"benzinga","correct":"import benzinga"},{"note":"NewsClient is in benzinga.news submodule, not top-level.","wrong":"from benzinga import NewsClient","symbol":"NewsClient","correct":"from benzinga.news import NewsClient"},{"note":"InstrumentsClient is in benzinga.instruments submodule.","wrong":"from benzinga import InstrumentsClient","symbol":"InstrumentsClient","correct":"from benzinga.instruments import InstrumentsClient"}],"quickstart":{"code":"import benzinga\n\nclient = benzinga.Client(api_key=os.environ.get('BENZINGA_API_KEY', ''), retries=3, timeout=30)\ndata = client.data(symbols=['AAPL'], start_date='2024-01-01', end_date='2024-01-05', format='json')\nprint(data)","lang":"python","description":"Initialize client with API key, fetch data for AAPL."},"warnings":[{"fix":"Use `client = benzinga.Client(api_key='...')` instead of raw requests.","message":"In version 1.x, the Client class replaced the old legacy API calls. Ensure you instantiate Client with api_key, retries, timeout.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"`client.data(symbols=[...], format='pandas')`","message":"The `data()` method returns raw JSON by default. To get a pandas DataFrame, you must pass `format='pandas'`.","severity":"gotcha","affected_versions":"all"},{"fix":"Set BENZINGA_API_KEY environment variable or pass string to Client.","message":"API key is required for all requests. The library does not read environment variables automatically; you must pass the key explicitly.","severity":"gotcha","affected_versions":"all"},{"fix":"Update to >=1.20 and add retries=3, timeout=30.","message":"The `retries` and `timeout` parameters in Client were introduced in version 1.20. Older code without these may timeout on slow connections.","severity":"deprecated","affected_versions":"<1.20"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"pip install benzinga","cause":"Library not installed.","error":"ModuleNotFoundError: No module named 'benzinga'"},{"fix":"Ensure you have a valid Benzinga API key and pass it to Client: Client(api_key='your_key_here')","cause":"Invalid or missing API key.","error":"benzinga.exceptions.AuthenticationError: 401 Client Error: Unauthorized"},{"fix":"Upgrade benzinga: pip install --upgrade benzinga","cause":"Old version of benzinga (<1.20) does not support retries/timeout.","error":"TypeError: Client() got an unexpected keyword argument 'retries'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}