'Unable to connect jenkins server and fetch job information

I have jenkins ec2 instance installed in mobxterm and via python jenkins api i need to exrtract the job information. The code is

from jenkinsapi.jenkins import Jenkins

def get_server_instance():
    jenkins_url = 'http://10.220.116.190:8080/'
    server = Jenkins(jenkins_url, username = 'admin', password = 'admin123')
    return server

if __name__ == '__main__':
    print (get_server_instance().version)

I having been trying to connect to my jenkins server but i keep getting a MaxRetryError error image



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source