Metadata-Version: 2.4
Name: kagi_client
Version: 1.0.0rc2
Summary: Kagi API
Home-page: 
Author: API Support
Author-email: API Support <support@kagi.com>
License: Apache-2.0
Project-URL: Repository, https://github.com/kagisearch/kagi-openapi-python
Keywords: OpenAPI,OpenAPI-Generator,Kagi API
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: urllib3<3.0.0,>=2.1.0
Requires-Dist: python-dateutil>=2.8.2
Requires-Dist: pydantic>=2.11
Requires-Dist: typing-extensions>=4.7.1
Dynamic: author

# kagi-client
The Kagi API provides programmatic access to data that powers our search results & more. 

Get started on the [API Dashboard](https://kagi.com/api) to set up billing, manage API keys, and more.

### Official Client Libraries

We offer the following libraries you can use to interact with the Kagi API. These are generated from an OpenAPI spec. If you have a language you would like to use and it's not in the list, send us a message and we will add it to the list if it is supported. Or you can use the [spec](https://kagi.redocly.app/_spec/openapi.yaml?download) to build your own custom library.

- [Golang](https://github.com/kagisearch/kagi-openapi-golang)
- [Python](https://github.com/kagisearch/kagi-openapi-python)
- [TypeScript](https://github.com/kagisearch/kagi-openapi-typescript)
- [Rust](https://github.com/kagisearch/kagi-openapi-rust)

### API Status

**The v1 API is currently in preview to early access testers.**

Our existing API, the \"v0\" beta API, is being replaced with a new version that will be available publicly soon. As changes are made, we will be updating the documentation below when the new features become available.

See the [Support and Community](https://help.kagi.com/kagi/support-and-community/) section for details.

### Pricing

See our [API Pricing](https://kagi.com/api/pricing) page for standard rates.

### GitHub Discussions

This is the preferred venue for bug reports and feature requests.

- [Bug Reports](https://github.com/kagisearch/kagi-docs/issues/new/choose)
- [Q&A Forum](https://github.com/kagisearch/kagi-docs/discussions/categories/q-a?discussions_q=category%3AQ%26A+label%3Aproduct%3Akagi_search_api)
- [API Feature Requests](https://github.com/kagisearch/kagi-docs/discussions/categories/kagi-search-api-feature-requests-ideas)

### Discord

Join our [Discord](https://kagi.com/discord)! Good for quick questions or chatting about things you've made with our APIs!


This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 1
- Package version: 1.0.0rc2
- Generator version: 7.22.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
For more information, please visit [https://kagi.com/support](https://kagi.com/support)

## Requirements.

Python 3.10+

## Installation & Usage
### PyPI

```sh
pip install kagi-client
```

> **Note:** If you're installing a prerelease version, add the `--pre` flag:
> ```sh
> pip install --pre kagi-client
> ```

Then import the package:
```python
import kagi_client
```

### From source

```sh
pip install git+https://github.com/kagisearch/kagi-openapi-python.git
```

Then import the package:
```python
import kagi_client
```

### Tests

Execute `pytest` to run the tests.

## Getting Started

Please follow the [installation procedure](#installation--usage) and then run the following:

```python

import kagi_client
from kagi_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://kagi.com/api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = kagi_client.Configuration(
    host = "https://kagi.com/api/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: kagi
configuration = kagi_client.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)


# Enter a context with an instance of the API client
with kagi_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = kagi_client.ExtractApi(api_client)
    extract_request = {"pages":[{"url":"https://example.com/article1"},{"url":"https://example.com/article2"}],"timeout":1.337,"format":"json"} # ExtractRequest | 

    try:
        # Extract page content as markdown from URLs
        api_response = api_instance.extract_content(extract_request)
        print("The response of ExtractApi->extract_content:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling ExtractApi->extract_content: %s\n" % e)

```

## Documentation for API Endpoints

All URIs are relative to *https://kagi.com/api/v1*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*ExtractApi* | [**extract_content**](docs/ExtractApi.md#extract_content) | **POST** /extract | Extract page content as markdown from URLs
*SearchApi* | [**search**](docs/SearchApi.md#search) | **POST** /search | Perform a web search


## Documentation For Models

 - [ErrorDetail](docs/ErrorDetail.md)
 - [ErrorEnvelope](docs/ErrorEnvelope.md)
 - [ExtractRequest](docs/ExtractRequest.md)
 - [ExtractResponse](docs/ExtractResponse.md)
 - [Meta](docs/Meta.md)
 - [PageInput](docs/PageInput.md)
 - [PageOutput](docs/PageOutput.md)
 - [Search200Response](docs/Search200Response.md)
 - [Search200ResponseData](docs/Search200ResponseData.md)
 - [SearchRequest](docs/SearchRequest.md)
 - [SearchRequestExtract](docs/SearchRequestExtract.md)
 - [SearchRequestFilters](docs/SearchRequestFilters.md)
 - [SearchRequestLens](docs/SearchRequestLens.md)
 - [SearchRequestPersonalizations](docs/SearchRequestPersonalizations.md)
 - [SearchRequestPersonalizationsDomainsInner](docs/SearchRequestPersonalizationsDomainsInner.md)
 - [SearchRequestPersonalizationsRegexesInner](docs/SearchRequestPersonalizationsRegexesInner.md)
 - [SearchResult](docs/SearchResult.md)
 - [SearchResultImage](docs/SearchResultImage.md)


<a id="documentation-for-authorization"></a>
## Documentation For Authorization


Authentication schemes defined for the API:
<a id="kagi"></a>
### kagi

- **Type**: Bearer authentication


## Author

support@kagi.com


