# Very slow request or connectTimeoutError - RequestsLibrary Robotframework

**URL:** <https://forum.robotframework.org/t/very-slow-request-or-connecttimeouterror-requestslibrary-robotframework/4196>\
**Category:** RequestsLibrary\
**Created:** [15 July 2022 03:55 UTC](https://forum.robotframework.org/t/very-slow-request-or-connecttimeouterror-requestslibrary-robotframework/4196 "2022-07-15T03:55:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![toaiphan](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/toaiphan/32/2143_2.png) [@toaiphan](https://forum.robotframework.org/u/toaiphan)\
**Post date:** [15 July 2022 03:55 UTC](https://forum.robotframework.org/t/very-slow-request-or-connecttimeouterror-requestslibrary-robotframework/4196/1 "2022-07-15T03:55:43Z")

</div>

![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/0/039d2d01a1a5540f727d512372ef0da8199934b5.png)

I automation API but it very slow , sometimes connectTimeoutError. Please help me

---

<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:** [15 July 2022 14:15 UTC](https://forum.robotframework.org/t/very-slow-request-or-connecttimeouterror-requestslibrary-robotframework/4196/2 "2022-07-15T14:15:27Z")

</div>

Hi @toaiphan,

If it’s simply your AUT taking time to respond, you can increase the timeout:

- [Create Session](https://robotframework-requests.netlify.app/doc/requestslibrary#Create%20Session) has a timeout option where you can set the timeout, so you can increase it from the default value.
- [POST](https://robotframework-requests.netlify.app/doc/requestslibrary#POST)’s \*\*kwargs also has a timeout option (documented in [GET](https://robotframework-requests.netlify.app/doc/requestslibrary#GET)) that you can use to set the timeout for specific requests.

But the question is why is the AUT taking so much time to respond?

- Is it something in the way your test is setup
- is it a fault with the AUT? can you reproduce this behaviour manually, if so, it’s a defect nothing to change in your test.

Somethings I did notice that you may need to pay attention to:

- you create a session, but then don’t use it? [POST On Session](https://robotframework-requests.netlify.app/doc/requestslibrary#POST%20On%20Session) might be a better option than POST, also you might want to create the session in a [Suite setup](http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#toc-entry-406) so you can reuse the session for all your tests
- Your Authorisation=Bearer is hard coded:
  - does this expire after a few minutes? is the timeout’s you’re experiencing because the of a timed out Authorisation?
  - is there a limit to the number of sessions/connections that can use the same Bearer value? the first two tests used up the limit and the 3rd++ tests are timing out as the server is forcing them to wait for the first 2 sessions to expire? (if so, go back to my comment about creating the session in a Suite setup)

Hopefully something here will help you solve your issue,

Dave.
