> For the complete documentation index, see [llms.txt](https://athena-10.gitbook.io/athena-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://athena-10.gitbook.io/athena-api/getting-started/python-sdk.md).

# Python SDK

Athena provides a Python package to make it easier to work with our APIs.&#x20;

<https://pypi.org/project/athenanewsapi/>

### **First, install the package:**

`pip install athenanewsapi`

If you haven't already, go ahead and create an [Athena News API account](https://app.runathena.com/register).

From there, you can run searches without ever having to touch the APIs.

```python
from athenanews import news

API_KEY = "Your API Key"
articles = articles = news(start_date="2025-02-01", end_date="2025-03-10", query="Tesla dealership protests", key_phrases="('Tesla')", api_key=API_KEY)

print("Total Articles: " + str(len(articles)))
for a in articles:
    print(a['title'])
    print(a['url']

```

### **Python SDK Parameter Reference**

* **start\_date (str):** ISO formatted start date.
* **end\_date (str):** ISO formatted end date.
* **query (str):** The search query.
* **key\_phrases (str):** Key phrases to refine the search. (ex: `('elon' or 'musk') and not 'sam altman'`)
* **toggle\_state (str):** The toggle state (e.g., "All Articles" or "Encoded Articles").
* **api\_key (str):** Your Athena API key.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://athena-10.gitbook.io/athena-api/getting-started/python-sdk.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
