# Fail importing REQUESTS python module

**URL:** <https://forum.inductiveautomation.com/t/fail-importing-requests-python-module/55079>\
**Category:** Ignition\
**Tags:** python\
**Created:** [January 17, 2022, 5:03pm UTC](https://forum.inductiveautomation.com/t/fail-importing-requests-python-module/55079 "2022-01-17T17:03:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lavi.ram86](https://avatars.discourse-cdn.com/v4/letter/l/58956e/32.png) [@lavi.ram86](https://forum.inductiveautomation.com/u/lavi.ram86)\
**Post date:** [January 17, 2022, 5:03pm UTC](https://forum.inductiveautomation.com/t/fail-importing-requests-python-module/55079/1 "2022-01-17T17:03:53Z")

</div>

Hi all,

I am trying to import requests module into my gateway.  
I have tried two different versions: requests-0.2.4 and requests-2.27.1

after importing the module I can’t use the definition\method request

when typing help(requests) I get:

```auto
>>> help(requests024)
Help on javapackage object:

requests024 = class javapackage(object)
 | Data and other attributes defined here:
 |  
 | __dict__ = <dictproxy object at 0x3>
 |  
 | __dir__ = <java function __dir__ 0x5>
 |  
 |  
 | __findattr_ex__ = <java function __findattr_ex__ 0x7>
 |  
 |  
 | __mgr__ = <reflected field public org.python.core.packagec...ger org.p...
 |  
 | __new__ = <built-in method __new__ of type object at 0x9>
 | T. __new__ (S, ...) -> a new object with type S, a subtype of T
 |  
 | __setattr__ = <java function __setattr__ 0xb>
 |  
 |  
 | addClass = <java function addClass 0xd>
 |  
 |  
 | addPackage = <java function addPackage 0xf>
 |  
 |  
 | addPlaceholders = <java function addPlaceholders 0x11>
 |  
 |  
 | clsSet = <reflected field public org.python.core.PyStringMap org.pytho...
 |  
 | fillDir = <java function fillDir 0x14>
 |  
 |  
 | refersDirectlyTo = <java function refersDirectlyTo 0x16>
 |  
 |  
 | toString = <java function toString 0x18>
 |  
 |  
 | traverse = <java function traverse 0x1a>

```

so I understand that the module is not ready loaded correctly.

when trying to load different module , let’s say XML  
and writing help(XML)

I get

```auto
>>> help(xml)
Help on package xml:

NAME
    xml - Core XML support for Jython.

FILE
    c:\users\raml\.ignition\cache\gwlocalhost_8088\c0\pylib\xml\ __init__.py

DESCRIPTION
    This package contains two sub-packages:
    
    dom -- The W3C Document Object Model. This supports DOM Level 1 +
           Namespaces.
    
    sax -- The Simple API for XML, developed by XML-Dev, led by David
           Megginson and ported to Python by Lars Marius Garshol. This
           supports the SAX 2 API.

PACKAGE CONTENTS
    FtCore
    Uri
    dom (package)
    etree (package)
    parsers (package)
    sax (package)

DATA
    __all__ = ['dom', 'sax']

```

can anyone spot the issue?

thanks

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 17, 2022, 5:39pm UTC](https://forum.inductiveautomation.com/t/fail-importing-requests-python-module/55079/2 "2022-01-17T17:39:47Z")

</div>

Please edit your post to make it readable: highlight each section of pasted plain text and code and click the “preformatted text” button.

---

<div class="post-metadata">

**Author:** ![lavi.ram86](https://avatars.discourse-cdn.com/v4/letter/l/58956e/32.png) [@lavi.ram86](https://forum.inductiveautomation.com/u/lavi.ram86)\
**Post date:** [January 17, 2022, 5:55pm UTC](https://forum.inductiveautomation.com/t/fail-importing-requests-python-module/55079/3 "2022-01-17T17:55:13Z")

</div>

thank you for your comment Phil,  
done.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 17, 2022, 6:39pm UTC](https://forum.inductiveautomation.com/t/fail-importing-requests-python-module/55079/4 "2022-01-17T18:39:54Z")

</div>

I don't see anything obviously wrong. Jython is built on java, so seeing java information is not a surprise. (And jython `help()` is not particularly helpful.) More helpful would be the backtrace you get when you try to _ **use** _ it and it fails. But first, make sure the version you choose is compatible with jython 2.5 (Ignition v7.9.x) or jython 2.7 (Ignition v8+). Also see this topic:

> [@Python, Jython, CPython, Libraries, Pip, and Python 2.7 vs 3 - A quick primer](https://forum.inductiveautomation.com/t/python-jython-cpython-libraries-pip-and-python-2-7-vs-3-a-quick-primer/43201):
>
> We wrote up a Knowledge Base article a little while back that I wanted to post here. It goes over a variety of questions that are common with regard to Python in Ignition. If you’re looking for information on the topic, take a glance at the linked article.

{ side note: the "3rd party modules" category is for authors of Ignition add-on modules, like me, to advertise our products. It doesn't refer to 3rd party **python** modules. Consider changing the category to get wider visibility for your question. }

---

<div class="post-metadata">

**Author:** ![lavi.ram86](https://avatars.discourse-cdn.com/v4/letter/l/58956e/32.png) [@lavi.ram86](https://forum.inductiveautomation.com/u/lavi.ram86)\
**Post date:** [January 18, 2022, 11:24am UTC](https://forum.inductiveautomation.com/t/fail-importing-requests-python-module/55079/5 "2022-01-18T11:24:04Z")

</div>

When trying to run requests.request(…)

requests.request(“GET”, url, headers=headers, params=querystring)

I get:

```auto
Traceback (most recent call last):
  File "<input>", line 4, in <module>
AttributeError: 'javapackage' object has no attribute 'request'

```

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [January 18, 2022, 1:17pm UTC](https://forum.inductiveautomation.com/t/fail-importing-requests-python-module/55079/6 "2022-01-18T13:17:05Z")

</div>

If you’re just trying to do the standard HTTP Verbs requests, why not use Ignitions built-in way `system.net.httpClient` [system.net.httpClient - Ignition User Manual 8.0 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC80/system.net.httpClient)

```auto
client = system.net.httpClient()
 
# Sent a GET request
response = client.get("https://httpbin.org/get", params={"a": 1, "b": 2})

```

---

<div class="post-metadata">

**Author:** ![lavi.ram86](https://avatars.discourse-cdn.com/v4/letter/l/58956e/32.png) [@lavi.ram86](https://forum.inductiveautomation.com/u/lavi.ram86)\
**Post date:** [January 18, 2022, 1:43pm UTC](https://forum.inductiveautomation.com/t/fail-importing-requests-python-module/55079/7 "2022-01-18T13:43:48Z")

</div>

Hi,  
thank you for your comment.  
this is actually my current solution but I would be glad the succeed with importing this module in order to understand a bit better how to work with external modules and the specific Requests module seems to be an appropriate choice as I see that some people already used it in the ignition.
