# How to set up proxy

**URL:** <https://forum.robotframework.org/t/how-to-set-up-proxy/6704>\
**Category:** Robot Framework\
**Created:** [22 January 2024 20:00 UTC](https://forum.robotframework.org/t/how-to-set-up-proxy/6704 "2024-01-22T20:00:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bayramguney](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@bayramguney](https://forum.robotframework.org/u/bayramguney)\
**Post date:** [22 January 2024 20:00 UTC](https://forum.robotframework.org/t/how-to-set-up-proxy/6704/1 "2024-01-22T20:00:07Z")

</div>

i am trying to convert RestAssured-Selenium Project to the Robot framework. I need help on setting up proxy for this method below. Thanks.

public static Response ticketCreate(TicketCreate payload) {  
RestAssured.proxy(“some url”, 8080);  
Object Routes;  
return given()  
.auth()  
.preemptive()  
.basic(readConfig.getAuthUsername(),readConfig.getAuthPassword())  
.contentType(ContentType.JSON)  
.accept(ContentType.JSON)  
.body(payload)  
.when()  
.post(Routes.ticketCreate);  
}

---

<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:** [22 January 2024 21:41 UTC](https://forum.robotframework.org/t/how-to-set-up-proxy/6704/2 "2024-01-22T21:41:32Z")

</div>

Hi Bayram,

You didn’t say which robot framework library you are using?

Since you are trying to script what looks like a REST API, I’ll take a guess at RequestsLibrary, the documenttaion on proxy settings can be found here [Create Session](https://marketsquare.github.io/robotframework-requests/doc/RequestsLibrary.html#Create%20Session)

Dave.

---

<div class="post-metadata">

**Author:** ![bayramguney](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@bayramguney](https://forum.robotframework.org/u/bayramguney)\
**Post date:** [23 January 2024 13:55 UTC](https://forum.robotframework.org/t/how-to-set-up-proxy/6704/3 "2024-01-23T13:55:45Z")

</div>

Hi Dave,  
Thanks for quick reply. Yes i am trying to use RequestLibrary. The documentation is not so clear to me .That s why i could not implement proxy setting the way i did in RestAPI. I searched but no luck finding an example so far.

List item

---

<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:** [23 January 2024 14:17 UTC](https://forum.robotframework.org/t/how-to-set-up-proxy/6704/4 "2024-01-23T14:17:33Z")

</div>

Hi Bayram,

So this

> [@bayramguney](#):
>
> RestAssured.proxy(“some url”, 8080);

Becomes something like this:

```python
	${proxies}= Create Dictionary http=some url:8080 https=some url:8080
	Create Session yourapp http://your.app.server proxies=${proxies}
	POST On Session yourapp http://your.app.server/your/endpoint json=${jsonrequestbody}

```

The difference being that with your current code you need to all proxies, headers, cookies etc every time, with RequestsLibrary session, you only do it once for `Create Session` after that you can POST and GET on session as many times as you need

If you put the create session part in a suite setup you can use the same session for all your test cases and save yourself a lot of effort

Hopefully that clears things up,

Dave.

---

<div class="post-metadata">

**Author:** ![bayramguney](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@bayramguney](https://forum.robotframework.org/u/bayramguney)\
**Post date:** [23 January 2024 17:05 UTC](https://forum.robotframework.org/t/how-to-set-up-proxy/6704/5 "2024-01-23T17:05:14Z")

</div>

Thanks your help Dave. After doing some small modification in your script , it worked well.
