<commit_before><p align="center"><img src="https://github.com/swiftype/swiftype-enterprise-python/blob/master/logo-enterprise-search.png?raw=true" alt="Elastic Enterprise Search Logo"></p>

> A first-party Python client for [Elastic Enterprise Search](https://www.elastic.co/solutions/enterprise-search).

## Contents

+ [Getting started](#getting-started-)
+ [Usage](#usage)
+ [FAQ](#faq-)
+ [Contribute](#contribute-)
+ [License](#license-)

***

## Getting started 🐣

Supports Python 2.7 and Python 3.3+.

Depends on [futures](https://github.com/PythonCharmers/python-future) and [requests](https://github.com/requests/requests).

Installed with
`pip <http://pypi.python.org/pypi/pip>`:

```bash
$ python -m pip install swiftype_enterprise
```

You can also download and install the project source:

```bash
$ python setup.py install
```

## Usage

Retrieve your access token and a content source key after creating your content source.

Indexing a document into a custom content source:

```python
  from swiftype_enterprise import SwiftypeEnterpriseClient
  from swiftype_enterprise.exceptions import SynchronousDocumentIndexingFailed
  content_source_key = 'content source key'
  authorization_token = 'authorization token'
  client = SwiftypeEnterpriseClient(authorization_token)
  documents = [
    {
      'id': '1234',
      'url': 'https://github.com/swiftype/swiftype-enterprise-python',
      'title': 'Swiftype Enterprise Python Github',
      'body': 'A descriptive body, with document contents and metadata'
    }
  ]
  try:
    document_results = client.index_documents(content_source_key, documents, timeout=10, delay=2)
    print(document_results)
  except SynchronousDocumentIndexingFailed:
    # Timed out before documents could finish indexing
    pass
```

## FAQ 🔮

### Where do I report issues with the client?

If something is not working as expected, please open an [issue](https://github.com/swiftype/swiftype-enterprise-python/issues/new).

## Contribute 🚀

We welcome contributors to the project. Before you begin, a couple notes...

+ Before opening a pull request, please create an issue to [discuss the scope of your proposal](https://github.com/swiftype/swiftype-enterprise-python/issues).
+ Please write simple code and concise documentation, when appropriate.

## License 📗

[MIT](https://github.com/swiftype/swiftype-enterprise-python/blob/master/LICENSE) © [Elastic](https://github.com/elastic)

Thank you to all the [contributors](https://github.com/swiftype/swiftype-enterprise-python/graphs/contributors)!<commit_msg>Document how to change endpoint<commit_after><p align="center"><img src="https://github.com/swiftype/swiftype-enterprise-python/blob/master/logo-enterprise-search.png?raw=true" alt="Elastic Enterprise Search Logo"></p>

> A first-party Python client for [Elastic Enterprise Search](https://www.elastic.co/solutions/enterprise-search).

## Contents

+ [Getting started](#getting-started-)
+ [Usage](#usage)
+ [FAQ](#faq-)
+ [Contribute](#contribute-)
+ [License](#license-)

***

## Getting started 🐣

Supports Python 2.7 and Python 3.3+.

Depends on [futures](https://github.com/PythonCharmers/python-future) and [requests](https://github.com/requests/requests).

Installed with
`pip <http://pypi.python.org/pypi/pip>`:

```bash
$ python -m pip install swiftype_enterprise
```

You can also download and install the project source:

```bash
$ python setup.py install
```

## Usage

Retrieve your access token and a content source key after creating your content source.

Indexing a document into a custom content source:

```python
  from swiftype_enterprise import SwiftypeEnterpriseClient
  from swiftype_enterprise.exceptions import SynchronousDocumentIndexingFailed
  content_source_key = 'content source key'
  authorization_token = 'authorization token'
  client = SwiftypeEnterpriseClient(authorization_token)
  documents = [
    {
      'id': '1234',
      'url': 'https://github.com/swiftype/swiftype-enterprise-python',
      'title': 'Swiftype Enterprise Python Github',
      'body': 'A descriptive body, with document contents and metadata'
    }
  ]
  try:
    document_results = client.index_documents(content_source_key, documents, timeout=10, delay=2)
    print(document_results)
  except SynchronousDocumentIndexingFailed:
    # Timed out before documents could finish indexing
    pass
```

### Change API endpoint

```python
client = SwiftypeEnterpriseClient(authorization_token, "https://your-server.example.com/api/v1/ent")
```

## FAQ 🔮

### Where do I report issues with the client?

If something is not working as expected, please open an [issue](https://github.com/swiftype/swiftype-enterprise-python/issues/new).

## Contribute 🚀

We welcome contributors to the project. Before you begin, a couple notes...

+ Before opening a pull request, please create an issue to [discuss the scope of your proposal](https://github.com/swiftype/swiftype-enterprise-python/issues).
+ Please write simple code and concise documentation, when appropriate.

## License 📗

[MIT](https://github.com/swiftype/swiftype-enterprise-python/blob/master/LICENSE) © [Elastic](https://github.com/elastic)

Thank you to all the [contributors](https://github.com/swiftype/swiftype-enterprise-python/graphs/contributors)!
{'fraction_non_alphanumeric': 0.1228436018957346, 'fraction_numerical': 0.004360189573459716, 'mean_word_length': 4.894972067039106, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 21, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7160881', 'n_tokens_mistral': 1664, 'n_tokens_neox': 1563, 'n_words': 424}