# Python script and API integration

**URL:** <https://forum.uipath.com/t/python-script-and-api-integration/187637>\
**Category:** Help\
**Tags:** question, python, webapi, activities\
**Created:** [January 23, 2020, 9:58am UTC](https://forum.uipath.com/t/python-script-and-api-integration/187637 "2020-01-23T09:58:53Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ankita121](https://avatars.discourse-cdn.com/v4/letter/a/97f17d/32.png) [@Ankita121](https://forum.uipath.com/u/Ankita121)\
**Post date:** [January 23, 2020, 9:58am UTC](https://forum.uipath.com/t/python-script-and-api-integration/187637/1 "2020-01-23T09:58:53Z")

</div>

I have to automate REST API web service. I have been provided with the parameters of the tabs that i need to work in the form of javascript but they cannot be used on their own. So python script will be used . In python funtions i will provide those parameters and then it will work but i am not able to correlate this. Can anyone help me out with this?

---

<div class="post-metadata">

**Author:** ![Pradeep\_Shiv](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pradeep_shiv/32/496519_2.png) [@Pradeep\_Shiv](https://forum.uipath.com/u/Pradeep_Shiv)\
**Post date:** [January 23, 2020, 10:10am UTC](https://forum.uipath.com/t/python-script-and-api-integration/187637/2 "2020-01-23T10:10:29Z")

</div>

you are integrating python with uipath? right?

---

<div class="post-metadata">

**Author:** ![Ankita121](https://avatars.discourse-cdn.com/v4/letter/a/97f17d/32.png) [@Ankita121](https://forum.uipath.com/u/Ankita121)\
**Post date:** [January 23, 2020, 12:15pm UTC](https://forum.uipath.com/t/python-script-and-api-integration/187637/3 "2020-01-23T12:15:28Z")

</div>

yes right

---

<div class="post-metadata">

**Author:** ![Pradeep\_Shiv](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pradeep_shiv/32/496519_2.png) [@Pradeep\_Shiv](https://forum.uipath.com/u/Pradeep_Shiv)\
**Post date:** [January 23, 2020, 12:19pm UTC](https://forum.uipath.com/t/python-script-and-api-integration/187637/4 "2020-01-23T12:19:56Z")

</div>

here you go  
Cheers @Ankita121  
[Integrate With Python.xaml](https://forum.uipath.com/uploads/short-url/2dxW0cJ5wO7gHuQsZVwAccD7An1.xaml) (10.7 KB)

---

<div class="post-metadata">

**Author:** ![Ankita121](https://avatars.discourse-cdn.com/v4/letter/a/97f17d/32.png) [@Ankita121](https://forum.uipath.com/u/Ankita121)\
**Post date:** [January 23, 2020, 12:20pm UTC](https://forum.uipath.com/t/python-script-and-api-integration/187637/5 "2020-01-23T12:20:34Z")

</div>

thank you 🙂

---

<div class="post-metadata">

**Author:** ![Pradeep\_Shiv](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pradeep_shiv/32/496519_2.png) [@Pradeep\_Shiv](https://forum.uipath.com/u/Pradeep_Shiv)\
**Post date:** [January 23, 2020, 12:20pm UTC](https://forum.uipath.com/t/python-script-and-api-integration/187637/6 "2020-01-23T12:20:55Z")

</div>

let me know if this works

---

<div class="post-metadata">

**Author:** ![Ankita121](https://avatars.discourse-cdn.com/v4/letter/a/97f17d/32.png) [@Ankita121](https://forum.uipath.com/u/Ankita121)\
**Post date:** [January 23, 2020, 12:22pm UTC](https://forum.uipath.com/t/python-script-and-api-integration/187637/7 "2020-01-23T12:22:35Z")

</div>

yes i am trying it now and i will let you know

---

<div class="post-metadata">

**Author:** ![Ankita121](https://avatars.discourse-cdn.com/v4/letter/a/97f17d/32.png) [@Ankita121](https://forum.uipath.com/u/Ankita121)\
**Post date:** [January 23, 2020, 12:28pm UTC](https://forum.uipath.com/t/python-script-and-api-integration/187637/8 "2020-01-23T12:28:07Z")

</div>

i have downloaded this xaml when i am using it i found the error saying activity could not be loaded because of errors in xaml. i am sharing the screenshot of that.

 ![uipath error](https://global.discourse-cdn.com/uipath/original/3X/f/2/f25bdc938984606f063cf9b280406ccf2741a3d7.png)

---

<div class="post-metadata">

**Author:** ![Ankita121](https://avatars.discourse-cdn.com/v4/letter/a/97f17d/32.png) [@Ankita121](https://forum.uipath.com/u/Ankita121)\
**Post date:** [January 23, 2020, 12:28pm UTC](https://forum.uipath.com/t/python-script-and-api-integration/187637/9 "2020-01-23T12:28:37Z")

</div>

which version of uipath and python you have used?

---

<div class="post-metadata">

**Author:** ![Pradeep\_Shiv](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pradeep_shiv/32/496519_2.png) [@Pradeep\_Shiv](https://forum.uipath.com/u/Pradeep_Shiv)\
**Post date:** [January 23, 2020, 2:45pm UTC](https://forum.uipath.com/t/python-script-and-api-integration/187637/10 "2020-01-23T14:45:27Z")

</div>

install python package from manage packages

---

<div class="post-metadata">

**Author:** ![Ankita121](https://avatars.discourse-cdn.com/v4/letter/a/97f17d/32.png) [@Ankita121](https://forum.uipath.com/u/Ankita121)\
**Post date:** [January 24, 2020, 6:22am UTC](https://forum.uipath.com/t/python-script-and-api-integration/187637/11 "2020-01-24T06:22:57Z")

</div>

i have already installed that.

---

<div class="post-metadata">

**Author:** ![Pradeep\_Shiv](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pradeep_shiv/32/496519_2.png) [@Pradeep\_Shiv](https://forum.uipath.com/u/Pradeep_Shiv)\
**Post date:** [January 24, 2020, 6:23am UTC](https://forum.uipath.com/t/python-script-and-api-integration/187637/12 "2020-01-24T06:23:38Z")

</div>

![image](https://global.discourse-cdn.com/uipath/original/3X/1/c/1c4d25475038218b679d9cf8fc600fe8adda91c1.png)  
this is my version

---

<div class="post-metadata">

**Author:** ![Pradeep\_Shiv](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pradeep_shiv/32/496519_2.png) [@Pradeep\_Shiv](https://forum.uipath.com/u/Pradeep_Shiv)\
**Post date:** [January 24, 2020, 6:23am UTC](https://forum.uipath.com/t/python-script-and-api-integration/187637/13 "2020-01-24T06:23:58Z")

</div>

1.1.6863.33404

---

<div class="post-metadata">

**Author:** ![Ankita121](https://avatars.discourse-cdn.com/v4/letter/a/97f17d/32.png) [@Ankita121](https://forum.uipath.com/u/Ankita121)\
**Post date:** [January 24, 2020, 6:29am UTC](https://forum.uipath.com/t/python-script-and-api-integration/187637/14 "2020-01-24T06:29:19Z")

</div>

i have the same version. I refreshed it and i can see the code now. Thanks

---

<div class="post-metadata">

**Author:** ![Rohaan\_Nadeem2](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rohaan_nadeem2/32/179591_2.png) [@Rohaan\_Nadeem2](https://forum.uipath.com/u/Rohaan_Nadeem2)\
**Post date:** [September 2, 2021, 1:20pm UTC](https://forum.uipath.com/t/python-script-and-api-integration/187637/15 "2021-09-02T13:20:09Z")

</div>

Guys, I am trying to load this python file via a python script but it crashes with a ‘Pipe is Broken’ error. Can you guys help me out?

Link to pickled model: [pickled\_model.sav - Google Drive](https://drive.google.com/file/d/1kdNLlXMdJatT-FKSR3Wb37P6yOGqolQf/view?usp=sharing)

Python Script:

```auto
import pickle
import numpy as np

def predict_label(x_test):
    filename = 'D:\\My POCs\\UiPath - Pickled Model\\pickled_model_2.pkl'

    loaded_model = pickle.load(open(filename, 'rb'))
    file1 = open("D:\\My POCs\\UiPath - Pickled Model\\Model_pickling\\myfile.txt","w")
    file1.write(x_test)
    file1.write('\n')
    file1.close()

```

I know I have chosen the right activities because this script works when I comment out the pickle.load command.

Thanks
