Skip to main content

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 keywords
  • language – article language code
  • country – country code
  • category – news category
  • start_date – start date (YYYY-MM-DD or datetime object)
  • end_date – end date (YYYY-MM-DD or datetime object)

Available Resources

api.available_languages()
api.available_regions()
api.available_category()

Examples

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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for currentsapi 0.1.1
File Size Uploaded
currentsapi-0.1.1.tar.gz 10.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for currentsapi 0.1.1
File Interpreter ABI Platform
currentsapi-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 16.6 kB

Release files / currentsapi-0.1.1.tar.gz

Download URL currentsapi-0.1.1.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0fed391839344e69524b5c7dcfac9c6cae424260358ca8e0b63fe43f1ecef29c
BLAKE2b-256 checksum
How to use checksums
adbbdf4bee61c0192c982568d5d9682f598d4f49faf6950890f7adb2202ca927
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.1-py3-none-any.whl

Download URL currentsapi-0.1.1-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4269ec0b562950b37406f981fe1edb6115c302b9c0f0bb6d6a619b245b3fcc9d
BLAKE2b-256 checksum
How to use checksums
2631c0444d5e5921f7ac4ab944cb3197fe6e9d5b75c820b15644c1f4ddec0dc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

0.1.3

2 release files

0.1.2

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page