newsdataapi 0.3.5__tar.gz → 0.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/PKG-INFO +5 -3
  2. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/README.md +4 -2
  3. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/src/newsdataapi/__init__.py +1 -1
  4. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/src/newsdataapi/client.py +600 -19
  5. newsdataapi-0.4.1/src/newsdataapi/constants.py +43 -0
  6. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/src/newsdataapi/csv_export.py +35 -1
  7. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/src/newsdataapi/exceptions.py +6 -4
  8. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/src/newsdataapi/websocket.py +1 -0
  9. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/tests/test_integration.py +45 -0
  10. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/tests/test_unit.py +535 -0
  11. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/tests/test_websocket.py +14 -0
  12. newsdataapi-0.3.5/src/newsdataapi/constants.py +0 -34
  13. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/.github/workflows/ci.yml +0 -0
  14. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/.github/workflows/publish.yml +0 -0
  15. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/.gitignore +0 -0
  16. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/.python-version +0 -0
  17. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/LICENSE +0 -0
  18. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/examples/basic_usage.py +0 -0
  19. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/examples/websocket_usage.py +0 -0
  20. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/newsdata-logo.png +0 -0
  21. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/pyproject.toml +0 -0
  22. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/src/newsdataapi/py.typed +0 -0
  23. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/tests/__init__.py +0 -0
  24. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/tests/conftest.py +0 -0
  25. {newsdataapi-0.3.5 → newsdataapi-0.4.1}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: newsdataapi
3
- Version: 0.3.5
3
+ Version: 0.4.1
4
4
  Summary: Official Python client (SDK) for the Newsdata.io News API — fetch real-time, historical, crypto, and stock-market news via REST, with validation, retries, pagination, and typed exceptions.
5
5
  Project-URL: Homepage, https://newsdata.io
6
6
  Project-URL: Documentation, https://newsdata.io/documentation
@@ -300,13 +300,15 @@ client = NewsDataApiClient(
300
300
  proxies={"https": "..."}, # passed with every request
301
301
  accept_language="en", # Accept-Language header
302
302
  include_headers=False, # if True, returned dicts include response_headers
303
- base_url="...", # override for staging / proxied environments
303
+ base_url="...", # API root; override for staging / proxied environments
304
304
  session=my_session, # inject your own requests.Session
305
305
  folder_path="./out", # default folder for save_to_csv; default None
306
306
  )
307
307
  ```
308
308
 
309
- Defaults sleep about a minute total across all retries (2 s → 4 s → 8 s → 16 s → 32 s, capped at 60 s); 429 responses honor `Retry-After` (both integer-seconds and HTTP-date forms are parsed). The API key is redacted in log output.
309
+ `base_url` (and `set_base_url()`) is the API root without a version segment; the default is `https://newsdata.io/api`, and the client adds the version itself. Before 0.4.0 it included the version (`https://newsdata.io/api/1/`), so drop the trailing `/1/` if you override it.
310
+
311
+ A request that fails with a server error, a rate limit, or a network error is attempted 5 times by default, sleeping 2 s, 4 s, 8 s and 16 s between attempts (30 s in total; a single sleep never exceeds `retry_backoff_max`). A 429 response is instead retried after the server's `Retry-After` plus one second (both integer-seconds and HTTP-date forms are parsed); when `Retry-After` is longer than `retry_backoff_max`, the client does not wait and raises `NewsdataRateLimitError` with `retry_after` set. The API key is redacted in log output.
310
312
 
311
313
  ## Development
312
314
 
@@ -248,13 +248,15 @@ client = NewsDataApiClient(
248
248
  proxies={"https": "..."}, # passed with every request
249
249
  accept_language="en", # Accept-Language header
250
250
  include_headers=False, # if True, returned dicts include response_headers
251
- base_url="...", # override for staging / proxied environments
251
+ base_url="...", # API root; override for staging / proxied environments
252
252
  session=my_session, # inject your own requests.Session
253
253
  folder_path="./out", # default folder for save_to_csv; default None
254
254
  )
255
255
  ```
256
256
 
257
- Defaults sleep about a minute total across all retries (2 s → 4 s → 8 s → 16 s → 32 s, capped at 60 s); 429 responses honor `Retry-After` (both integer-seconds and HTTP-date forms are parsed). The API key is redacted in log output.
257
+ `base_url` (and `set_base_url()`) is the API root without a version segment; the default is `https://newsdata.io/api`, and the client adds the version itself. Before 0.4.0 it included the version (`https://newsdata.io/api/1/`), so drop the trailing `/1/` if you override it.
258
+
259
+ A request that fails with a server error, a rate limit, or a network error is attempted 5 times by default, sleeping 2 s, 4 s, 8 s and 16 s between attempts (30 s in total; a single sleep never exceeds `retry_backoff_max`). A 429 response is instead retried after the server's `Retry-After` plus one second (both integer-seconds and HTTP-date forms are parsed); when `Retry-After` is longer than `retry_backoff_max`, the client does not wait and raises `NewsdataRateLimitError` with `retry_after` set. The API key is redacted in log output.
258
260
 
259
261
  ## Development
260
262
 
@@ -17,7 +17,7 @@ from .exceptions import (
17
17
  )
18
18
  from .websocket import NewsDataApiWebSocket
19
19
 
20
- __version__ = "0.3.5"
20
+ __version__ = "0.4.1"
21
21
 
22
22
  __all__ = [
23
23
  "NewsDataApiClient",