Commit Graph
133 Commits
Author SHA1 Message Date
Seth Michael LarsonandSeth Michael Larson 02e3323650 [7.x] Add AIOHttpConnection 2020-05-21 11:36:21 -05:00
Seth Michael LarsonandSeth Michael Larson 8e1798cf31 Apply license header changes and API gen 2020-04-23 14:10:49 -05:00
Seth Michael LarsonandGitHub f0280d9302 [7.x] Decode HTTP response body with "surrogatepass" 2020-04-23 09:21:34 -05:00
Seth Michael LarsonandGitHub 7f07f1f728 [7.x] Surface deprecation warnings from Elasticsearch 2020-03-31 14:44:20 -05:00
Seth Michael LarsonandGitHub 7b6a12f2e5 Remove opaque_id from the client constructor 2020-03-19 13:23:52 -05:00
Seth Michael LarsonandGitHub ae74e1d0e6 [7.x] Update Cloud ID default port, parsing of Cloud ID 2020-03-12 07:02:04 -05:00
Seth Michael LarsonandGitHub 9219c92779 [7.x] Add support for X-Opaque-Id 2020-03-11 16:33:15 -05:00
Seth Michael LarsonandSeth Michael Larson 210fae23d0 Run Black+Flake8 on project 2020-03-09 13:54:47 -05:00
Seth Michael LarsonandGitHub 04403ffb1d [7.x] Refactor cloud_id, api_key, headers, and http_compress 2020-03-04 13:07:07 -06:00
Seth Michael LarsonandGitHub b0bc6418e3 [7.x] Add HTTP compression to RequestsHttpConnection 2020-03-03 10:17:58 -06:00
Seth Michael LarsonandGitHub 1bda6aca8a [7.x] Don't issue warning when using 'ssl_context' 2020-02-26 15:57:30 -06:00
Honza Král cc461fdc3c Disable urllib3 warningns if not ssl_show_warn 2019-12-12 23:43:16 +01:00
Alvaro OlmedoandHonza Král c3fd04b5db Disable InsecureRequestWarning from urllib3's connectionpool with ssl_show_warn option 2019-12-12 22:25:49 +01:00
Alex KahanandHonza Král a2e9f0c807 Closes #1044. Fixing bug with mark_dead in connection pool 2019-10-29 17:01:47 +01:00
Honza Král 4c531c5cdb When turning of ssl verification, make sure it propagates to urllib3 2019-10-01 22:03:55 +02:00
Philip KraussandHonza Král c4bc2e420d API key Authentication (#1010) 2019-09-20 14:01:31 +01:00
Philip KraussandHonza Král 28920b5d59 Ensure a custom User-Agent header is not overwritten (#992) 2019-08-12 14:20:10 +02:00
Nick LangandGitHub 60d254860b Add support for using cloud_id when instantiating conections (#957)
* add cloud_id

* adding doc strings

* update changelog

* adding some tests to check for cloud_id

* update the read me
2019-05-21 21:21:34 -05:00
svaleeandNick Lang b6fe0d424f Added equality check for Connection class (#938)
* Added equality check for Connection class

* ES: make connection hashable
2019-05-15 18:25:58 -04:00
Nick LangandGitHub 206f5e2754 Black (#948) 2019-05-10 09:16:33 -06:00
Nick LangandGitHub 1afceba69b update to ES 7 (#911)
* update to ES 7

* more updates to make tests run

* update the test matrix

* remove python 3.3

* update xpack apis

* relative imports
2019-03-29 09:25:23 -06:00
Alvaro Olmedo RodriguezandNick Lang 51ad5d3617 ssl_show_warn option added (#913)
* ssl_show_warn option added

* Typo fixed
2019-03-28 13:20:16 -06:00
Mike MarshallandNick Lang 6cdf258f61 fix python 3.x str.decode exception (#877)
* fix python 3.x str.decode exception

* Moved try clause inside the if statement

* Moved try clause inside the if statement
2018-12-10 16:32:54 -07:00
Chris WynneandNick Lang 67deac55c4 Pass Retry object to urllib3 instead of False (#827)
By passing a `Retry` object to `urlopen` instead of just `False`, it
prevents `urllib3` from having to create a Retry object with `from_int`.

`from_int` emits an undesirable log message when called with
`retries=False`, and this can be avoided by the method described above.
2018-07-24 11:24:13 -07:00
Nick LangandGitHub 206e0d609c handle gzip for python27. Fixes #789 (#793) 2018-05-18 13:52:37 -06:00
Ilya RadinskyandNick Lang 4dc4ba18ad Fixes double creation of urllib3.HTTPSConnectionPool when ssl_context and use_ssl are used (#780) 2018-05-01 13:54:17 -06:00
robgilandNick Lang 64c125d34c Adding GZip support to urllib3 (#704)
* Adding GZip support to urllib3

* Adding compression documentation and example

* Convert to lowercase for consistency

* Moving header manipulation to __init__()

* Validating headers for compression

* Moving body compression out of the headers block

* Don't compress if there is no body

* Infer true
2018-03-13 10:34:25 -06:00
Nick LangandGitHub 058d38f0ae Use use ssl_context or don't but don't mix (#714)
* Use original SSL process and add SSLContext

Not going to deprecate and replace with SSLContext.
But instead give option for using SSLContext next to the original way of
handling SSL.
2018-03-04 15:09:40 -08:00
Honza Král eaa67a100d use_ssl flag is set by Connection
This wasn't an issue before as scheme=https was not documented but now
it is in the docs and it makes this entire block be skipped if url is
given without scheme and no ssl_context is passed completely breaking
ssl
2018-01-18 16:12:07 +01:00
Honza Král a023bddb4d Use provided request headers in urllib3
outside. However, `Urllib3HttpConnection` did not use these headers but
only its default ones.

With this commit, `Urllib3HttpConnection` will either use the default
ones or merge the default headers with the provided ones if there are
any.

Relates #618
2018-01-01 15:42:46 +01:00
Nick Lang 456e598c5b moving import 2017-12-28 13:09:16 -07:00
Nick Lang bf1d64e88d Updates to SSL Context changes,
Bug with OSX made breaking changes to the way certifi was being imported
and used.

Unable to reproduce with Linux.

Found improper logic. Fixed now.
Also changing removing the flag for checking `verify_certs` as
it is `True` by default. Don't want to make users flag that as
`False` just to make things work.

A connection to an SSL instance should be:

    es = Elasticsearch("https://host:port", http_auth=(user,pass))

* If using Elastic Cloud or some other publicly recognized certificate
  that certifi can recognize.
2017-12-27 20:26:23 -07:00
Nick LangandHonza Král 37490e223f When _just_ using an SSL context we don't want breaking behavior (#673)
Also don't want to break backwards compat. So when chcking for depreicated values ignore
the check on verify_certs. Since it's True. the verify certs will be default true
in the ssl_context. And can be turned off in the SSL context when using it.
2017-11-28 22:01:20 +01:00
Honza Král f639f9b28e Apply cafile defaults before checking for emptiness
Fixes #669
2017-11-14 19:20:15 +01:00
Nick LangandGitHub 5c537deca4 Merge pull request #635 from fxdgear/nick/ssl_context
Nick/ssl context
2017-10-06 11:35:23 -06:00
Nick Lang 7339a272b5 Add SSL context for versions of Python that support SSL Context.
Instead of passing parameters manually, you can construct an SSL
context. This allows for greater flexibility in using self signed certs.
2017-10-06 11:27:15 -06:00
Joshua Carp 3045516738 Clean up custom headers. 2017-10-04 16:07:55 -04:00
Joshua Carp 073db90ae8 Set application/x-ndjson content type on bulk requests.
Resolves #609
2017-10-04 16:07:55 -04:00
Tyler James HardenandHonza Král cd769b98a5 Additional fixes for UTF-8 surrogate escapes (#629)
* Fixes non UTF-8 surrogateescapes 

Surrogate escapes in Unicode (non UTF-8 encoding) will be properly escaped with backslashes when encountered, versus breaking the transport layer.

* Removes erroneous bytes decode and reraises

Fixes to re-raise exceptions with different reasons
Removes erroneous bytes decode where bytes are desired

* Adds test for surrogate escapes in body

Tests that a surrogate escape sequence is properly escaped
with backslashes to produce valid UTF-8.

* Use proper byte sequence for surrogate

* Use if/else versus pass

* Proper Unicode surrogate escape

Use a Unicode Surrogate that properly escapes in both Python2 and Python3

* Passing test once surrogatepass is used

Updating test to pass once surrogatepass is used

* Use surrogatepass instead of backslashreplace

This replicates behavior between Python 2 and Python 3

* Fixes whitespace

* Simplifies with no exception block

Since `surrogatepass` will only ever explicitly occur when there are surrogate bytes encountered, there is no need to let the error throw and catch it, also uses single-quotes for consistency.

* Fixes Unicode Surrogate Escapes in request logging

This is the same fix as accepted for ElasticSearch requests, except applied to the request logging mechanisms.
2017-08-15 15:41:32 +01:00
Honza Král d336c571b9 [WIP] remove scheme checking 2017-05-15 22:01:54 +02:00
Honza Král c318f7fa63 Make sure environment settings are merged in for requests
Fixes #557
2017-04-17 21:59:03 +02:00
Honza Král 597bf7ade9 Log proper headers in trace logs 2017-03-05 11:19:01 -08:00
Honza Král d862c8a799 Add content-type default headers with application/json 2017-02-08 20:50:50 +01:00
Honza Král 8107bbcf93 update headers in lowercase to allow overriding of auth headers 2017-01-03 15:07:28 +01:00
Honza Král b9ba12977f Refactored connection error handling 2016-12-15 16:46:05 +11:00
Javier AguirreandHonza Král 8e69b98844 Fix UnboundLocalError response (#476) (#481) 2016-12-06 18:10:44 +01:00
Honza Král 8b96556769 Change the trace logger to also include failed requests 2016-10-19 15:28:31 +02:00
Honza Král bf561fb856 Fix maxsize parameter description.
Fixes #414 Thanks theanti9!
2016-10-17 17:27:33 +02:00
Honza Král 8314f7b25c Set verify_certs default to True
If certifi is installed use it as default for ca_certs value
Closes #403
2016-10-17 14:16:56 +02:00
Honza Král 515197a903 Don't try and decode an empty body 2016-07-28 11:26:55 +02:00