Skip to content

Commit ce6d2d6

Browse files
committed
Updates readme
1 parent 22bc06f commit ce6d2d6

File tree

1 file changed

+10
-121
lines changed

1 file changed

+10
-121
lines changed

README.md

Lines changed: 10 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,127 +1,16 @@
1-
**Note:** The readme/code you are seeing it's part of upcoming release: Algolia API Client Python v2.
1+
**Note:** The readme/code you are seeing it's part of upcoming release: Algolia API Client Python **v2**.
22

3-
Algolia's Python client provides the perfect starting point to integrate
4-
Algolia into your Python application. It is carefully crafted to simplify the usage
5-
of Algolia within your Python Project.
3+
# Algolia Search API Client for Python
64

7-
## Preface
5+
[Algolia Search](https://www.algolia.com) is a hosted search engine capable of delivering realtime results from the first keystroke.
86

9-
- Tons of new features: contains waitable response objects, up-to-date retry strategy, `replace_all_objects`,`clear_objects`, and more!
7+
The **Algolia Search API Client for Python** lets
8+
you easily use the [Algolia Search REST API](https://www.algolia.com/doc/rest-api/search) from
9+
your Python code.
1010

11-
- Supports Python: **2.7 🥳**, 3.4, 3.5, 3.6, and 3.7.
11+
[![Build Status](https://travis-ci.org/algolia/algoliasearch-client-python.svg?branch=master)](https://travis-ci.org/algolia/algoliasearch-client-python) [![PyPI version](https://badge.fury.io/py/algoliasearch.svg?branch=master)](http://badge.fury.io/py/algoliasearch) [![Coverage Status](https://coveralls.io/repos/algolia/algoliasearch-client-python/badge.svg?branch=master)](https://coveralls.io/r/algolia/algoliasearch-client-python)
1212

13-
- Strong test suite, 100% test coverage on `unittest` (tests === **30secs locally!** 🏎), `flake8`
14-
(linter), and `mypy` (static-analysis) to ensure the quality of the code.
13+
## Getting Help
1514

16-
- Supports synchronous and **asynchronous** environments. 👉🏻 **Yes, in the same client and with support Python 2. It's amazing!** Asynchronous methods are available using the `async` suffix:
17-
18-
| synchronous | asynchronous |
19-
|-------------- |-------------------- |
20-
| search | search_async |
21-
| save_objects | save_objects_async |
22-
| ... | ... |
23-
24-
## Contributing
25-
26-
Thank you for considering to contribute to Algolia's API Client Python v2. Here is the list of tasks that I would love to get your help:
27-
28-
1. Using Python v1 within Algolia for non-critical projects? Start using this v2 today!
29-
3. Analyze the code quality
30-
4. Analyze the quality of tests
31-
5. Create a [free account](https://www.algolia.com/users/sign_up/hacker) at Algolia, and play with this client.
32-
33-
## Get started locally
34-
35-
> **Requires:**
36-
- **[Homebrew](https://brew.sh)**
37-
38-
First, use [Homebrew](https://brew.sh) to install Python 3.7:
39-
```bash
40-
# Install Python 3
41-
brew install python3
42-
43-
# Create your Python project directory
44-
mkdir my-new-project
45-
cd my-new-project
46-
47-
# Create a Python Virtual Environment inside your directory
48-
python3 -m venv venv
49-
50-
# Activate the Python Virtual Environment
51-
source venv/bin/activate
52-
53-
# At any time, use the following command to deactivate it
54-
deactivate
55-
```
56-
57-
Finally, install `algoliasearch` - API Client Python v2:
58-
```
59-
pip install https://github.com/algolia/algoliasearch-client-python/archive/develop.zip
60-
```
61-
62-
### Synchronous example:
63-
64-
```py
65-
import os
66-
67-
from algoliasearch.search_client import SearchClient
68-
from algoliasearch.exceptions import AlgoliaException
69-
70-
client = SearchClient.create(
71-
os.environ.get('ALGOLIA_APPLICATION_ID_1'),
72-
os.environ.get('ALGOLIA_ADMIN_KEY_1')
73-
)
74-
75-
index = client.init_index('articles')
76-
77-
index.save_objects([
78-
{'objectID': 1, 'firstname': 'Jimmie', 'lastname': 'Barninger'},
79-
{'objectID': 2, 'firstname': 'Warren', 'lastname': 'Speach'}
80-
]).wait()
81-
82-
hits = index.search('Jimmie')
83-
84-
print(hits)
85-
```
86-
87-
### Asynchronous example:
88-
89-
First, require asynchronous libraries:
90-
91-
```
92-
pip install 'asyncio>=3.4,<4.0' 'aiohttp>=2.0,<4.0' 'async_timeout>=2.0,<4.0'
93-
```
94-
95-
96-
```py
97-
import asyncio
98-
import os
99-
100-
from algoliasearch.search_client import SearchClient
101-
from algoliasearch.exceptions import AlgoliaException
102-
from algoliasearch.responses import MultipleResponse
103-
104-
app_id = os.environ.get('ALGOLIA_APPLICATION_ID_1')
105-
api_key = os.environ.get('ALGOLIA_ADMIN_KEY_1')
106-
107-
108-
async def main():
109-
async with SearchClient.create(app_id, api_key) as client:
110-
index = client.init_index('articles')
111-
112-
try:
113-
(await index.clear_objects_async()).wait()
114-
except AlgoliaException: # Index not found
115-
pass
116-
117-
results = await asyncio.gather(
118-
index.save_object_async({'objectID': 1, 'foo': 'bar'}),
119-
index.save_object_async({'objectID': 2, 'foo': 'foo'})
120-
)
121-
122-
MultipleResponse(results).wait()
123-
124-
print(await index.search_async(''))
125-
126-
asyncio.run(main())
127-
```
15+
- **Need help**? Ask a question to the [Algolia Community](https://discourse.algolia.com/) or on [Stack Overflow](http://stackoverflow.com/questions/tagged/algolia).
16+
- **Found a bug?** You can open a [GitHub issue](https://github.com/algolia/algoliasearch-client-python/issues).

0 commit comments

Comments
 (0)