Commit Graph
34 Commits
Author SHA1 Message Date
Oleksandr LoykoandGitHub 4091816f84 Fixed lint error. (#875)
Signed-off-by: Alex Loyko <[email protected]>
2024-12-21 08:39:12 -05:00
b9e48dc847 Fix AuthorizationException with AWSV4SignerAsyncAuth when the doc ID has special characters. (#848)
* Lifecycle integration tests.

Signed-off-by: dblock <[email protected]>

* Added a test that makes sure the slash is properly encoded.

Signed-off-by: dblock <[email protected]>

* Added more tests for signer and _make_path.

Signed-off-by: Nathalie Jonathan <[email protected]>

* Prevent AIOHttpConnection from encoding the url a second time.

Signed-off-by: Nathalie Jonathan <[email protected]>

---------

Signed-off-by: dblock <[email protected]>
Signed-off-by: Nathalie Jonathan <[email protected]>
Co-authored-by: dblock <[email protected]>
2024-11-27 17:50:22 -05:00
samypr100andGitHub 1269cdc95a feat(AsyncOpenSearch): consistent pool_maxsize setting (#845)
Signed-off-by: samypr100 <[email protected]>
2024-11-12 09:21:32 -05:00
55f9940d51 Remove HEAD-handling hack. (#794)
* remove HEAD -> GET workaround

Signed-off-by: dblock <[email protected]>

* Removed remaining HEAD-handling code.

Signed-off-by: dblock <[email protected]>

* Fixed remaining references to admin:admin.

Signed-off-by: dblock <[email protected]>

---------

Signed-off-by: dblock <[email protected]>
Co-authored-by: Vincent Castaneda <[email protected]>
2024-08-15 10:15:13 -04:00
Hugo van KemenadeandGitHub 6e3f1a1194 Remove redundant mock backport dependency and upgrade syntax for Python 3.8+ (#785)
* Upgrade syntax with pyupgrade --py38-plus

Signed-off-by: Hugo van Kemenade <[email protected]>

* Convert to f-strings with flynt

Signed-off-by: Hugo van Kemenade <[email protected]>

* Format with Black

Signed-off-by: Hugo van Kemenade <[email protected]>

* Remove redundant mock backport dependency

Signed-off-by: Hugo van Kemenade <[email protected]>

* isort imports

Signed-off-by: Hugo van Kemenade <[email protected]>

* Add changelog entry

Signed-off-by: Hugo van Kemenade <[email protected]>

---------

Signed-off-by: Hugo van Kemenade <[email protected]>
2024-07-20 16:19:20 -04:00
Hugo van KemenadeandGitHub de96d28e45 Remove redundant six dependency (#781)
* Don't create universal wheel for Python 3 only

Signed-off-by: Hugo van Kemenade <[email protected]>

* Update Black target version to match min Python supported

Signed-off-by: Hugo van Kemenade <[email protected]>

* Upgrade files using six to Python 3 syntax

Signed-off-by: Hugo van Kemenade <[email protected]>

* Remove redundant six dependency

Signed-off-by: Hugo van Kemenade <[email protected]>

* Format with Black

Signed-off-by: Hugo van Kemenade <[email protected]>

* Add changelog entry

Signed-off-by: Hugo van Kemenade <[email protected]>

---------

Signed-off-by: Hugo van Kemenade <[email protected]>
2024-07-20 12:30:37 -04:00
Sai Medhini Reddy MaryadaandGitHub 58e9b1d66c Introduced service time metrics to OpenSearch-Py client. (#716)
* Introduced service time metrics to opensearch-py client

Signed-off-by: saimedhi <[email protected]>

* Introduced service time metrics to opensearch-py client

Signed-off-by: saimedhi <[email protected]>

* Introduced service time metrics to opensearch-py client

Signed-off-by: saimedhi <[email protected]>

* Added service time metrics

Signed-off-by: saimedhi <[email protected]>

---------

Signed-off-by: saimedhi <[email protected]>
Signed-off-by: Sai Medhini Reddy Maryada <[email protected]>
2024-04-15 07:20:46 -04:00
odelmarcelleandGitHub 3eba72c320 Reusable async client (#639)
* set aiohttp.ClientSession to None after close()

Signed-off-by: odlmarce <[email protected]>

* add test

Signed-off-by: odlmarce <[email protected]>

* update changelog

Signed-off-by: odlmarce <[email protected]>

* update changelog + format
Signed-off-by: odlmarce <[email protected]>

* update changelog
Signed-off-by: odlmarce <[email protected]>

* add tests using `with` and synchronous client
Signed-off-by: odlmarce <[email protected]>

* fix `urllib3.exceptions.ClosedPoolError` breaking synchronous client after `close`
Signed-off-by: odlmarce <[email protected]>

* update changelog
Signed-off-by: odlmarce <[email protected]>

* separate tests
Signed-off-by: odlmarce <[email protected]>

* refactor pool factory as lambda
Signed-off-by: odlmarce <[email protected]>

---------

Signed-off-by: odlmarce <[email protected]>
2024-01-02 13:33:24 -05:00
Samuel OrjiandGitHub 6f26eb3e8e remove unnecessary utf-8 header in .py files (#615)
* remove unnecessary utf-8 header in .py files

Signed-off-by: samuel orji <[email protected]>

* review feedback: add link to changelog

Signed-off-by: samuel orji <[email protected]>

---------

Signed-off-by: samuel orji <[email protected]>
2023-11-24 16:19:50 -05:00
Daniel (dB.) DoubrovkineandGitHub 1801ada270 Added pylint, enforce naming. (#590)
* Added pylint.

Signed-off-by: dblock <[email protected]>

* Enforce pylint:invalid-name.

Signed-off-by: dblock <[email protected]>

* Updated the generated code header to prevent broken links.

Signed-off-by: dblock <[email protected]>

* Swapped order of messages.

Signed-off-by: dblock <[email protected]>

---------

Signed-off-by: dblock <[email protected]>
2023-11-21 10:04:39 -08:00
Daniel (dB.) DoubrovkineandGitHub cec268e48d Fix for 592 (#594)
* Prepare for next developer iteration, 2.4.1.

Signed-off-by: dblock <[email protected]>

* Fix: sync opensearchpy without iohttp.

Signed-off-by: dblock <[email protected]>

* Use nox to run tests.

Signed-off-by: dblock <[email protected]>

---------

Signed-off-by: dblock <[email protected]>
2023-11-15 16:33:43 -08:00
Daniel (dB.) DoubrovkineandGitHub f02d6dee27 Avoid decoding request body unless it needs to be logged. (#571)
Signed-off-by: dblock <[email protected]>
Signed-off-by: Daniel (dB.) Doubrovkine <[email protected]>
2023-11-12 11:42:45 -08:00
Daniel (dB.) DoubrovkineandGitHub 58b83d8c06 Added Windows CI. (#569)
Signed-off-by: dblock <[email protected]>
2023-11-09 17:41:37 -08:00
Daniel (dB.) DoubrovkineandGitHub 56c96d7c4f Expanded type coverage to benchmarks, samples and tests. (#566)
* Renamed json samples to fix duplicate module name.

Signed-off-by: dblock <[email protected]>

* Enabled mypy on all source files.

Signed-off-by: dblock <[email protected]>

* Added missing types.

Signed-off-by: dblock <[email protected]>

* Added CHANGELOG.

Signed-off-by: dblock <[email protected]>

* Move type: ignore to fix untyped decorator makes function untyped.

Signed-off-by: dblock <[email protected]>

* Fix nox -rs lint-3.7.

Signed-off-by: dblock <[email protected]>

* Fixed incorrect import.

Signed-off-by: dblock <[email protected]>

* Fix broken test.

Signed-off-by: dblock <[email protected]>

* Fixed TestBulk::test_bulk_works_with_bytestring_body.

Signed-off-by: dblock <[email protected]>

---------

Signed-off-by: dblock <[email protected]>
2023-11-09 10:51:20 -05:00
Daniel (dB.) DoubrovkineandGitHub dcb79cc322 Merge .pyi type stubs inline (#563)
* Merged types into .py code.

Signed-off-by: dblock <[email protected]>

* Fix: nox -rs generate.

Signed-off-by: dblock <[email protected]>

* Updated CHANGELOG.

Signed-off-by: dblock <[email protected]>

* Use lowest common python version for lint.

Signed-off-by: dblock <[email protected]>

* Fix: don't typeshed.

Signed-off-by: dblock <[email protected]>

* Removed unneeded comment.

Signed-off-by: dblock <[email protected]>

* Simplify OPENSEARCH_URL.

Signed-off-by: dblock <[email protected]>

* Fix: positional ignore_status used as chunk_size.

Signed-off-by: dblock <[email protected]>

* Fix: parse version string.

Signed-off-by: dblock <[email protected]>

* Remove future annotations for Python 3.6.

Signed-off-by: dblock <[email protected]>

* Fix: types in documentation.

Signed-off-by: dblock <[email protected]>

* Improve CHANGELOG text.

Signed-off-by: dblock <[email protected]>

* Re-added missing separator.

Signed-off-by: dblock <[email protected]>

* Remove duplicate licenses.

Signed-off-by: dblock <[email protected]>

* Get rid of Optional[Any].

Signed-off-by: dblock <[email protected]>

* Fix docs with AsyncOpenSearch.

Signed-off-by: dblock <[email protected]>

* Fix: undo comment.

Signed-off-by: dblock <[email protected]>

---------

Signed-off-by: dblock <[email protected]>
2023-11-06 10:08:19 -08:00
Daniel (dB.) DoubrovkineandGitHub 0da60b2623 Added a utf-8 header to all .py files (#557)
Signed-off-by: dblock <[email protected]>
2023-10-26 13:34:34 -04:00
Daniel (dB.) DoubrovkineandGitHub 627e717534 Remove support for Python 2.x. (#548)
Signed-off-by: dblock <[email protected]>
2023-10-24 07:57:21 -07:00
Daniel (dB.) DoubrovkineandGitHub a1f942b6f9 Added support for AWS Sigv4 for UrlLib3. (#547)
* WIP: Added support for AWS Sigv4 for UrlLib3.

Signed-off-by: dblock <[email protected]>

* Refactored common implementation.

Signed-off-by: dblock <[email protected]>

* Added sigv4 samples.

Signed-off-by: dblock <[email protected]>

* Updated CHANGELOG.

Signed-off-by: dblock <[email protected]>

* Add documentation.

Signed-off-by: dblock <[email protected]>

* Use the correct class in tests.

Signed-off-by: dblock <[email protected]>

* Renamed samples.

Signed-off-by: dblock <[email protected]>

* Split up requests and urllib3 unit tests.

Signed-off-by: dblock <[email protected]>

* Rename AWSV4Signer.

Signed-off-by: dblock <[email protected]>

* Clarified documentation of when to use Urllib3AWSV4SignerAuth vs. RequestHttpConnection.

Signed-off-by: dblock <[email protected]>

* Move fetch_url inside the signer class.

Signed-off-by: dblock <[email protected]>

* Added unit test for Urllib3AWSV4SignerAuth adding headers.

Signed-off-by: dblock <[email protected]>

* Added unit test for signing to include query string.

Signed-off-by: dblock <[email protected]>

---------

Signed-off-by: dblock <[email protected]>
2023-10-23 19:46:19 -04:00
Daniel (dB.) DoubrovkineandGitHub 7a638cdafc Align pool_maxsize for different connection pool implementations. (#535)
* Align pool_maxsize for different connection pool implementations.

Signed-off-by: dblock <[email protected]>

* Document connection classes and settings.

Signed-off-by: dblock <[email protected]>

* Undo change in async for backwards compatibility.

Signed-off-by: dblock <[email protected]>

* Fix: typo.

Signed-off-by: dblock <[email protected]>

---------

Signed-off-by: dblock <[email protected]>
2023-10-12 18:55:31 -04:00
Daniel (dB.) DoubrovkineandGitHub 2bfc409177 Fix: typos. (#526)
* Fix: typo.

Signed-off-by: dblock <[email protected]>

* Fix: typo.

Signed-off-by: dblock <[email protected]>

* Fixed its.

Signed-off-by: dblock <[email protected]>

* Added Visual Code settings to .gitignore.

Signed-off-by: dblock <[email protected]>

* Added loop type for async client.

Signed-off-by: dblock <[email protected]>

---------

Signed-off-by: dblock <[email protected]>
2023-10-09 10:45:18 -07:00
12ebe82cba Fix string/tuple/no auth on AsyncHttpConnection class (#424)
* Fix string/tuple/no auth on AsyncHttpConnection class. Fixes #283

Signed-off-by: dannosaur <[email protected]>

* Update for PR comments. Add tests.

Signed-off-by: dannosaur <[email protected]>

* Moving tests to its own file.

Also had to install asynctest into the dev-requirements to get access to the context managers necessary to mock out aiohttp.

Signed-off-by: dannosaur <[email protected]>

* Update CHANGELOG

Signed-off-by: dannosaur <[email protected]>

* Linter fixes. Add license text to new file.

Signed-off-by: dannosaur <[email protected]>

* Move AsyncContextManagerMock to utils package for future re-use

Signed-off-by: dannosaur <[email protected]>

* Lint

Signed-off-by: dannosaur <[email protected]>

* Refactor async tests - remove asynctest package

Signed-off-by: dannosaur <[email protected]>

* Switch out to using aiounittest for async testing prior to py3.8

Signed-off-by: dannosaur <[email protected]>

* Use RequestContextManager from opensearchpy._asycn._extra_imports

Signed-off-by: dannosaur <[email protected]>

* Simplify test somewhat, move to `test_async` since all other async tests are ignored on runners <3.6

Signed-off-by: dannosaur <[email protected]>

* Lint

Signed-off-by: dannosaur <[email protected]>

---------

Signed-off-by: dannosaur <[email protected]>
Signed-off-by: Daniel (dB.) Doubrovkine <[email protected]>
Co-authored-by: Daniel (dB.) Doubrovkine <[email protected]>
2023-07-06 18:01:52 -04:00
Sai Medhini Reddy MaryadaandGitHub f1b5706ebd Added 'allow_redirects' parameter in perform_request function for RequestsHttpConnection (#401)
Signed-off-by: saimedhi <[email protected]>
2023-06-13 15:15:00 -04:00
Sai Medhini Reddy MaryadaandGitHub 2b9aee73a5 Added async support for helpers that are merged from opensearch-dsl-py (#329)
Signed-off-by: saimedhi <[email protected]>
2023-03-17 12:03:46 -07:00
Sai Medhini Reddy MaryadaandGitHub c58375aa7b Merging opensearch-dsl-py to opensearch-py (#287)
Signed-off-by: saimedhi <[email protected]>
2023-02-14 15:03:56 -08:00
Sai Medhini Reddy MaryadaandGitHub 93636399ec Removed 'out/opensearchpy' folder which was produced while generating pyi files for plugins (#288)
Signed-off-by: saimedhi <[email protected]>
2023-02-14 11:09:14 -08:00
Harsha Vamsi KalluriandGitHub cfb2cf7b60 Adding async support for AWSSigV4 (#254)
* Adding async support for AWSSigV4

Signed-off-by: Harsha Vamsi Kalluri <[email protected]>

* Fix names for connection classes

Signed-off-by: Harsha Vamsi Kalluri <[email protected]>

* Update tests to async name space

Signed-off-by: Harsha Vamsi Kalluri <[email protected]>

* Add import exceptions to python < 3.6

Signed-off-by: Harsha Vamsi Kalluri <[email protected]>

Signed-off-by: Harsha Vamsi Kalluri <[email protected]>
2023-01-02 17:25:48 -05:00
Jeppe Fihl-PearsonandGitHub 4c4091b12c Fix DeprecationWarning raised by urllib3 1.26.13 (#246)
* Fix DeprecationWarning raised by urllib3 1.26.13

urllib3 has started to emit a DeprecationWarning whenever
HTTPResponse.getheaders() is called since version 1.26.13.

This changes the one place where this is done to instead use
HTTPResponse.headers instead, which is the recommend way of retrieving
the headers going forwards.

Signed-off-by: Jeppe Fihl-Pearson <[email protected]>

* Add CHANGELOG entry

Signed-off-by: Jeppe Fihl-Pearson <[email protected]>

Signed-off-by: Jeppe Fihl-Pearson <[email protected]>
2022-12-01 11:26:24 -08:00
b6b35f4666 feat: Added pool_maxsize for RequestsHttpConnection (#216)
Signed-off-by: Niket Singh <[email protected]>

Signed-off-by: Niket Singh <[email protected]>
Co-authored-by: Niket Singh <[email protected]>
Co-authored-by: Harsha Vamsi Kalluri <[email protected]>
2022-12-01 11:24:59 -08:00
2672f3f572 Check OpenSSL environment variables before defaulting to certifi (#196)
* Check OpenSSL environment variables before defaulting to certifi

Signed-off-by: Roger Aiudi <[email protected]>

* Fix formatting

Signed-off-by: Roger Aiudi <[email protected]>

* Moved CA_CERTS to the base Connection module

Signed-off-by: Roger Aiudi <[email protected]>

* Updated requests Connection to use common CA_CERTS by default

Signed-off-by: Roger Aiudi <[email protected]>

* Pass nox linting

Signed-off-by: Roger Aiudi <[email protected]>

* Update CHANGELOG.md and USER_GUIDE.md

Signed-off-by: Roger Aiudi <[email protected]>

* Updated AIOHttpConnection to only load CA_CERTS if verify_certs is True

Signed-off-by: Roger Aiudi <[email protected]>

* Added test cases for CA_CERTS handling in each Connection implementation

Signed-off-by: Roger Aiudi <[email protected]>

* Move CA cert handling to Connection.default_ca_certs()
Add test cases for the different CA cert configurations

Signed-off-by: Roger Aiudi <[email protected]>

* Update actions to test unsupported Python versions on ubuntu-20.04

Signed-off-by: Roger Aiudi <[email protected]>

* Fix Python versions being interpreted as floats

Signed-off-by: Roger Aiudi <[email protected]>

* Workaround Monkeypatch not available on old pytest versions

Signed-off-by: Roger Aiudi <[email protected]>

Signed-off-by: Roger Aiudi <[email protected]>
Co-authored-by: Harsha Vamsi Kalluri <[email protected]>
2022-11-22 11:33:45 -05:00
2d03dc773b Alerting Plugins (#93)
* Alert Plugin

Signed-off-by: Arnav Das <[email protected]>

* lint file header license

Signed-off-by: Arnav Das <[email protected]>

* Tests For Alerting[Monitors]

Signed-off-by: Arnav Das <[email protected]>

* Tests For Alerting[Destinations]

Signed-off-by: Arnav Das <[email protected]>

* dynamic lookup 90#issuecomment-1003396742

Signed-off-by: Arnav Das <[email protected]>

* Alerting Async

Signed-off-by: Arnav Das <[email protected]>

* Lint Changes

Signed-off-by: Arnav Das <[email protected]>

* alerting plugins integration tests

Signed-off-by: Arnav Das <[email protected]>

* Integ UnitTests Skip on OPENSEARCH_VERSION >= 2.0.0

Signed-off-by: Arnav Das <[email protected]>

* Unit Test Skip Complete

Signed-off-by: Arnav Das <[email protected]>

* License Headers fixed

Signed-off-by: Arnav Das <[email protected]>

* test_urllib3_connection timeout

Signed-off-by: Arnav Das <[email protected]>

* lint

Signed-off-by: Arnav Das <[email protected]>

* Fix licenses in all files

Signed-off-by: Harsha Vamsi Kalluri <[email protected]>

* Remove elastic search licenses on new files

Signed-off-by: Harsha Vamsi Kalluri <[email protected]>

* Fix formatting

Signed-off-by: Harsha Vamsi Kalluri <[email protected]>

Signed-off-by: Arnav Das <[email protected]>
Signed-off-by: Harsha Vamsi Kalluri <[email protected]>
Co-authored-by: Harsha Vamsi Kalluri <[email protected]>
2022-10-03 14:45:18 -04:00
Philip MayandVijayan Balasubramanian 96bbbfa336 remove unused "type: ignore" comment
Signed-off-by: Philip May <[email protected]>
2022-02-01 13:05:37 -08:00
Shivam DharandShivam Dhar cfe1190a22 removes elastic support from opensearch-py library
Signed-off-by: Shivam Dhar <[email protected]>
2022-01-05 22:22:43 +05:30
Trevor McCullochandGitHub 1cd15b0845 Parse raw_data on error only if the Content-Type is application/json. (#91)
Some OpenSearch REST APIs will return a Content-Type of text/plain for certain
status codes which will trigger logging when the response is not parsable as
JSON. Checking the content-type first avoids this error.

This frequently happens with 401s, which occurs when we rotate user keys.
The input that triggers this behaviour can be triggered with `curl`:

```
$  curl -k -u"admin:wrong" -w"\n%{http_code}\n%{content_type}\n" https://localhost:9200/_cluster/health
Unauthorized
401
text/plain; charset=UTF-8
```

Signed-off-by: Trevor McCulloch <[email protected]>
2021-12-22 21:52:49 +02:00
Rushi Agrawal ef0c23c0e4 Rename module to opensearchpy
To avoid conflict with an existing package by name 'opensearch' being
present

Signed-off-by: Rushi Agrawal <[email protected]>
2021-09-16 21:23:38 +05:30