### Install currentsapi Package Source: https://github.com/currentslab/currentsapi-python/blob/master/README.md Install the currentsapi Python package using pip. ```bash pip install currentsapi ``` -------------------------------- ### Get Available Resource Lists Source: https://github.com/currentslab/currentsapi-python/blob/master/README.md Retrieve lists of supported languages, regions, and news categories available through the API. ```python api.available_languages() ``` ```python api.available_regions() ``` ```python api.available_category() ``` -------------------------------- ### Initialize CurrentsAPI Client Source: https://github.com/currentslab/currentsapi-python/blob/master/README.md Import the CurrentsAPI client and initialize it with your API key. This is required for all subsequent API calls. ```python from currentsapi import CurrentsAPI api = CurrentsAPI(api_key="YOUR_API_KEY") ``` -------------------------------- ### Available Resources Source: https://github.com/currentslab/currentsapi-python/blob/master/README.md Retrieve lists of available languages, regions, and categories. ```APIDOC ## Available Resources ### Description Retrieve lists of available languages, regions, and categories. ### Method GET ### Endpoint - /api/v1/available/languages - /api/v1/available/regions - /api/v1/available/categories ### Parameters None ### Request Example ```python api.available_languages() api.available_regions() api.available_category() ``` ### Response #### Success Response (200) - **languages** (array) - List of available language codes - **regions** (array) - List of available country codes - **categories** (array) - List of available news categories ``` -------------------------------- ### Authenticate API Requests Source: https://github.com/currentslab/currentsapi-python/blob/master/README.md All API requests are authenticated via an Authorization header. Ensure your API key is correctly passed during client instantiation. ```python api = CurrentsAPI(api_key="YOUR_API_KEY") ``` -------------------------------- ### Search News Articles by Keywords Source: https://github.com/currentslab/currentsapi-python/blob/master/README.md Search for news articles using keywords and filter by language. ```python api.search(keywords="OpenAI", language="en") ``` -------------------------------- ### Search News Articles with Advanced Filters Source: https://github.com/currentslab/currentsapi-python/blob/master/README.md Perform a news search using country, category, and date range filters. Dates should be in YYYY-MM-DD format or datetime objects. ```python api.search(country="US", category="technology", start_date="2024-01-01", end_date="2024-12-31") ``` -------------------------------- ### Retrieve Latest News Source: https://github.com/currentslab/currentsapi-python/blob/master/README.md Fetch the most recent news headlines. You can optionally filter results by language code. ```python api.latest_news() ``` ```python api.latest_news(language="en") ``` -------------------------------- ### Latest News Source: https://github.com/currentslab/currentsapi-python/blob/master/README.md Retrieve the latest news headlines. Optionally filter by language. ```APIDOC ## Latest News ### Description Retrieve the latest news headlines. Optionally filter by language. ### Method GET ### Endpoint /api/v1/latest-news ### Parameters #### Query Parameters - **language** (string) - Optional - Article language code ### Request Example ```python api.latest_news() api.latest_news(language="en") ``` ### Response #### Success Response (200) - **news** (array) - List of latest news articles ``` -------------------------------- ### Search News Source: https://github.com/currentslab/currentsapi-python/blob/master/README.md Search news articles with optional filters. ```APIDOC ## Search News ### Description Search news articles with optional filters. ### Method GET ### Endpoint /api/v1/search ### Parameters #### Query Parameters - **keywords** (string) - Optional - Search keywords - **language** (string) - Optional - Article language code - **country** (string) - Optional - Country code - **category** (string) - Optional - News category - **start_date** (string) - Optional - Start date (`YYYY-MM-DD` or `datetime` object) - **end_date** (string) - Optional - End date (`YYYY-MM-DD` or `datetime` object) ### Request Example ```python api.search(keywords="OpenAI", language="en") api.search(country="US", category="technology", start_date="2024-01-01", end_date="2024-12-31") ``` ### Response #### Success Response (200) - **news** (array) - List of news articles matching the search criteria ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.