currentsapi-python
The official Python SDK for the Currents API.
Installation
Install the package from PyPI. The distribution name is currentsapi (this
repository is currentsapi-python, and the Python import name is also
currentsapi):
pip install currentsapi
Python 3.8+ is supported.
Usage
Import the client and initialize it with your API key:
from currentsapi import CurrentsAPI
api = CurrentsAPI(api_key="YOUR_API_KEY")
Endpoints
Latest News
Retrieve the latest news headlines. Optionally filter by language:
api.latest_news()
api.latest_news(language="en")
Search
Search news articles with optional filters:
api.search(keywords="OpenAI", language="en")
api.search(country="US", category="technology", start_date="2024-01-01", end_date="2024-12-31")
Supported parameters:
keywords– search keywordslanguage– article language codecountry– country codecategory– news categorystart_date– start date (YYYY-MM-DDordatetimeobject)end_date– end date (YYYY-MM-DDordatetimeobject)
Available Resources
api.available_languages()
api.available_regions()
api.available_category()
Examples
- Generate a source-linked news briefing from a live Search API response or a deterministic offline fixture.
- Build a company news monitor with a JSON watchlist, bounded search window, local state, and deterministic fixture.
Authentication
All requests are authenticated using an Authorization header. Pass your API key when instantiating the client:
api = CurrentsAPI(api_key="YOUR_API_KEY")
Get your API key at https://currentsapi.services/en/register.
License
MIT License
Error handling
Any non-200 API response raises CurrentsAPIError, which exposes the parsed
response body:
from currentsapi.client import CurrentsAPIError
try:
api.latest_news()
except CurrentsAPIError as exc:
print(exc.status, exc.code, exc.message)
Metadata
Release files for currentsapi 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| currentsapi-0.1.0.tar.gz | 10.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| currentsapi-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.0 kB
Release files / currentsapi-0.1.0.tar.gz
| Download URL | currentsapi-0.1.0.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
455874b680352a3cc82b03ab0e2db8a77a8fe0ea0e73e1ab3a08150ed25aed4c
|
|
BLAKE2b-256 checksum How to use checksums |
425dd7d67e72edc72c94d26a3a52663adc208e656ebd89dfad6bcd933a9c7d6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / currentsapi-0.1.0-py3-none-any.whl
| Download URL | currentsapi-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
559cdc650bec58b5dda65a2954bad604d5df3171fe19603befc242b9e8d40115
|
|
BLAKE2b-256 checksum How to use checksums |
3b87be79701a8ea66be92ae3b78a211f3ef7ae67227ef3f226d42ed8460bf38a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|