# How can we make a http get request from a plugin

**URL:** <https://discourse.slicer.org/t/how-can-we-make-a-http-get-request-from-a-plugin/37668>\
**Category:** Development\
**Tags:** segmentation, python\
**Created:** [August 2, 2024, 11:25am UTC](https://discourse.slicer.org/t/how-can-we-make-a-http-get-request-from-a-plugin/37668 "2024-08-02T11:25:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![maniron](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@maniron](https://discourse.slicer.org/u/maniron)\
**Post date:** [August 2, 2024, 11:25am UTC](https://discourse.slicer.org/t/how-can-we-make-a-http-get-request-from-a-plugin/37668/1 "2024-08-02T11:25:43Z")

</div>

Hi,  
I am trying to hit my backend flask python server from the plugin which is integrated with 3D slicer but due to some reasons its not working. Kindly help me out how I can achieve it

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [August 2, 2024, 11:36am UTC](https://discourse.slicer.org/t/how-can-we-make-a-http-get-request-from-a-plugin/37668/2 "2024-08-02T11:36:03Z")

</div>

You can use the `requests` package from python to access http endpoints.

---

<div class="post-metadata">

**Author:** ![maniron](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@maniron](https://discourse.slicer.org/u/maniron)\
**Post date:** [August 2, 2024, 11:38am UTC](https://discourse.slicer.org/t/how-can-we-make-a-http-get-request-from-a-plugin/37668/3 "2024-08-02T11:38:19Z")

</div>

I tried , as I am working from an organization I guess I am not able to hit the end point, but the same URL works fine when I perform curl

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [August 2, 2024, 12:09pm UTC](https://discourse.slicer.org/t/how-can-we-make-a-http-get-request-from-a-plugin/37668/4 "2024-08-02T12:09:45Z")

</div>

Maybe there’s a proxy or other special case. You can debug this with python outside of slicer using various http packages or options and then whatever you find that works should also work inside Slicer.

---

<div class="post-metadata">

**Author:** ![maniron](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@maniron](https://discourse.slicer.org/u/maniron)\
**Post date:** [August 5, 2024, 5:19am UTC](https://discourse.slicer.org/t/how-can-we-make-a-http-get-request-from-a-plugin/37668/5 "2024-08-05T05:19:08Z")

</div>

Hi @pieper I tried the URL from browser and through curl command, both worked fine, but through slicer its not hitting the URL

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [August 5, 2024, 11:37am UTC](https://discourse.slicer.org/t/how-can-we-make-a-http-get-request-from-a-plugin/37668/6 "2024-08-05T11:37:15Z")

</div>

You should use the same python packages outside of slicer for testing and then use that same approach inside slicer.

---

<div class="post-metadata">

**Author:** ![maniron](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@maniron](https://discourse.slicer.org/u/maniron)\
**Post date:** [August 9, 2024, 4:13am UTC](https://discourse.slicer.org/t/how-can-we-make-a-http-get-request-from-a-plugin/37668/7 "2024-08-09T04:13:05Z")

</div>

Hi @pieper The issue was with VPN which was sorted and the HTTP get request is working thanks
