# How to make requests library ignore SSL errors

**URL:** <https://forum.robotframework.org/t/how-to-make-requests-library-ignore-ssl-errors/6790>\
**Category:** Libraries\
**Created:** [7 February 2024 14:41 UTC](https://forum.robotframework.org/t/how-to-make-requests-library-ignore-ssl-errors/6790 "2024-02-07T14:41:03Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![teknopaul](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@teknopaul](https://forum.robotframework.org/u/teknopaul)\
**Post date:** [7 February 2024 14:41 UTC](https://forum.robotframework.org/t/how-to-make-requests-library-ignore-ssl-errors/6790/1 "2024-02-07T14:41:04Z")

</div>

We have valid SSL buyt hostnames change, urllib3.disable\_warnings() seems it no longer works.

Any ideas?

Version: 7.0 (Python 3.10.12 on linux)

---

<div class="post-metadata">

**Author:** ![Sebplais](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@Sebplais](https://forum.robotframework.org/u/Sebplais)\
**Post date:** [7 February 2024 21:00 UTC](https://forum.robotframework.org/t/how-to-make-requests-library-ignore-ssl-errors/6790/2 "2024-02-07T21:00:43Z")

</div>

Hello @teknopaul  
from request library doc , you have the [Open session](https://marketsquare.github.io/robotframework-requests/doc/RequestsLibrary.html#Create%20Session) parameter **Verify=False** that should do the job if ssl error  
for other warnings : **disable\_warnings** parameter should also help

regards

---

<div class="post-metadata">

**Author:** ![teknopaul](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@teknopaul](https://forum.robotframework.org/u/teknopaul)\
**Post date:** [29 February 2024 13:52 UTC](https://forum.robotframework.org/t/how-to-make-requests-library-ignore-ssl-errors/6790/3 "2024-02-29T13:52:11Z")

</div>

Still get WARNs and failures.

[WARN] Certificate did not match expected hostname:

SSLError: HTTPSConnectionPool(host='…

---

<div class="post-metadata">

**Author:** ![teknopaul](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@teknopaul](https://forum.robotframework.org/u/teknopaul)\
**Post date:** [29 February 2024 13:55 UTC](https://forum.robotframework.org/t/how-to-make-requests-library-ignore-ssl-errors/6790/4 "2024-02-29T13:55:31Z")

</div>

SSLError: HTTPSConnectionPool(host=‘pr-c9606.{baseurl-redacted}’, port=443): Max retries exceeded with url: /sport-results/apidocs/ (Caused by SSLError(SSLCertVerificationError(“hostname ‘pr-c9606.{baseurl-redacted}’ doesn’t match either of ‘api.{baseurl-redacted}’, ‘docs.{baseurl-redacted}’”)))

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [29 February 2024 14:41 UTC](https://forum.robotframework.org/t/how-to-make-requests-library-ignore-ssl-errors/6790/5 "2024-02-29T14:41:51Z")

</div>

Hi @teknopaul,

If I’m reading that error correctly, you have a certificate that is valid for `api.{baseurl-redacted}` and `docs.{baseurl-redacted}`, but you are trying to use this certificate for a web server running on another server (`pr-c9606.{baseurl-redacted}`) where the certificate is not valid, so this is a different case from ignoring a certificate that’s simply never valid or self signed.

I’m not familiar with the code of requests library, but I suspect this is why you’re encountering this issue.

I guess the questions are,

- is this a bug in requests library? I’m not sure…
- Is this a bug with you’re environment?
  - did you request the `api.{baseurl-redacted}` host name and get redirected to `pr-c9606` indicating an issue with the load balancer?

- I would think in this situation, if I’ve understood it correctly, where there is a valid certificate but it’s being incorrectly used on the wrong server this should be an error and fail even when **Verify=False** , in this situation your IT people should be using a self signed cert rather than the cert they have used.

Dave.

---

<div class="post-metadata">

**Author:** ![teknopaul](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@teknopaul](https://forum.robotframework.org/u/teknopaul)\
**Post date:** [29 February 2024 15:37 UTC](https://forum.robotframework.org/t/how-to-make-requests-library-ignore-ssl-errors/6790/6 "2024-02-29T15:37:11Z")

</div>

Yeah, just the hostname is “wrong”. The SSL cert is valid for [api.myco.com](http://api.myco.com) but for pull requests we have [pr123.myco.com](http://pr123.myco.com) with the same cert.

Its actually a google certificate signed by them this is how our development in the cloud works. Previous robot versions did not have an issue.  
It would be nice if google would deploy a wildcard cert.

I doubt its a bug in requests, its a problem with **Verify=False** not being propagated for some reason from robot to urllib3.

AFAIK Its possible in urllib3 to turn off hostname validation and still validate the cert, that is common in most SSL libraries. If we could disable hostname validation that would be better because the cert is valid and this flow goes over the Internet sometimes.

---

<div class="post-metadata">

**Author:** ![teknopaul](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@teknopaul](https://forum.robotframework.org/u/teknopaul)\
**Post date:** [29 February 2024 15:42 UTC](https://forum.robotframework.org/t/how-to-make-requests-library-ignore-ssl-errors/6790/7 "2024-02-29T15:42:31Z")

</div>

> [@teknopaul](#):
>
> Verify=False

urllib3 has

```python
assert_hostname=False

```

---

<div class="post-metadata">

**Author:** ![teknopaul](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@teknopaul](https://forum.robotframework.org/u/teknopaul)\
**Post date:** [29 February 2024 17:34 UTC](https://forum.robotframework.org/t/how-to-make-requests-library-ignore-ssl-errors/6790/8 "2024-02-29T17:34:21Z")

</div>

Seems to be a bug in RequestKeyworkds.py to me session has verify:False

in \_common\_request() fuction

```
    resp = method_function(
        self._merge_url(session, uri), <- session has verify:False but it is not passed to kwargs
        timeout=self._get_timeout(kwargs.pop('timeout', None)),
        cookies=kwargs.pop('cookies', self.cookies),
        **kwargs)

    log.logger.error(kwargs) <- this is missing Verify: False

    kwargs.update({'verify': False}) <- if I add it it works

```

---

<div class="post-metadata">

**Author:** ![teknopaul](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@teknopaul](https://forum.robotframework.org/u/teknopaul)\
**Post date:** [29 February 2024 17:39 UTC](https://forum.robotframework.org/t/how-to-make-requests-library-ignore-ssl-errors/6790/9 "2024-02-29T17:39:40Z")

</div>

This is missing in requests lib, to pass the ssl bypass from session to the request

```
  kwargs.update({'verify': session.verify})

```

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [1 March 2024 01:48 UTC](https://forum.robotframework.org/t/how-to-make-requests-library-ignore-ssl-errors/6790/10 "2024-03-01T01:48:22Z")

</div>

Hi @teknopaul,

I’ve not looked at the code for requests, so it could well be a bug, might be best to raise an issue on the github page with this detail.

Dave.

---

<div class="post-metadata">

**Author:** ![teknopaul](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@teknopaul](https://forum.robotframework.org/u/teknopaul)\
**Post date:** [4 March 2024 10:51 UTC](https://forum.robotframework.org/t/how-to-make-requests-library-ignore-ssl-errors/6790/11 "2024-03-04T10:51:00Z")

</div>

Issue: [Verify=False is not propogated to bypass ssl verification · Issue #386 · MarketSquare/robotframework-requests · GitHub](https://github.com/MarketSquare/robotframework-requests/issues/386)

Pull Request: [Propagate verify=False from session to requests by phinds1 · Pull Request #387 · MarketSquare/robotframework-requests · GitHub](https://github.com/MarketSquare/robotframework-requests/pull/387)
