From bcaeae626606dc13e0bcf6ee9fcc0289fdd43f59 Mon Sep 17 00:00:00 2001 From: algoliareadmebot Date: Wed, 28 Sep 2016 15:53:17 +0000 Subject: [PATCH] docs(README): automatic update Update README Python [This list might not be relevant] Add documentation for restrictSources (#134) * Add documentation for restrictSources adding typescript setup to menu (#131) [ci skip] --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1cc447ca3..c832f39b7 100644 --- a/README.md +++ b/README.md @@ -2128,7 +2128,7 @@ You can restrict the key to a list of index names allowed for the secured API ke ```python # generate a public API key that is restricted to 'index1' and 'index2': -public_key = client.generate_secured_api_key('YourSearchOnlyApiKey', {'restrictIndices': valid_until}) +public_key = client.generate_secured_api_key('YourSearchOnlyApiKey', {'restrictIndices': 'index1,index2'}) ``` #### Rate Limiting @@ -2155,6 +2155,15 @@ even if he shares his `IP` with another user. public_key = client.generate_secured_api_key('YourSearchOnlyApiKey', {'filters': '_tags:user_42', 'userToken': 'user_42'}) ``` +#### Network restriction + +For more protection against API key leaking and reuse you can restrict the key to be valid only from specific IPv4 networks + +```python +# generate a public API key that is restricted to '192.168.1.0/24': +public_key = client.generate_secured_api_key('YourSearchOnlyApiKey', {'restrictSources': '192.168.1.0/24'}) +``` +