Import requests module error in python scripting

Hello Everyone,
I am using the requests module in python scripting for getting the real time weather data based on the location.
I am getting the error while running my script. I attached the image file here kindly help me to solve this error

here is my code for your reference

You should try using
and with that you can do get requests like

# Create the JythonHttpClient.
client =
# Sent a GET request.
response = client.get("", params={"a": 1, "b": 2})
# Validate the response.
if response.good:
    # Do something with the response
    print response.json['args']['a']

One thing to note in your script is you use an os.environ['weather']. All perspective scripts run in the gateway so this is always telling your Ignition Gateway to get the system variable weather from the gateway computer - this does not change user to user, so I would suggest either hardcoding it into a gateway tag and referencing that, or if you want it to be different user to user, use a session variable.


Whatever is going on here with the codec registry error is ultimately a Jython bug. Migrating to is going to be far less headache than trying to maintain an increasingly out-of-date version of requests over time.


@Baskar_Arumugam A general rule of thumb to follow is to look first is there is some system.* implementation of what you need to do before trying to use a jython library.

Jython has some randomly interspersed issues in various packages, so it is much safer (and probably faster, definitely more maintainable) to use Ignition’s implementation whenever possible.

ok Let me try and get back to you, Thankyou for your response