Mar-29-2018, 06:13 PM
Hello! First off I'm not a strong Python developer. I'm a Network Engineer and I use Python to create automation scripts for accessing routers and switches. I've never tried to convert a script of any type. A coworker asked me to help him convert a Perl script to Python. In my research and findings, I'm having some issues trying to find what I need in Python or even making it work.
The Perl script accesses Cisco's Call Manager (phone system) webpage (https, authenication, ignore SSL), it pulls data off the pages, may be more than one with up to 2000 line items on each page. It then parses it (XML) into two columns, userID and extensions, and dumps it into a .CSV file. It then reads that .CSV file, accesses Microsoft Active Directory, looks up the userID and puts the extension of that userID into the persons Active Directory profile under the ipPhone attribute.
The modules the Perl script uses are below vs what I've been trying to use in Python3...
Net::LDAP; = python3-ldap3
LWP::UserAgent; = urllib3
LWP::Protocol::https; = requests
XML::Simple; = lxml
Any help would be appreciated. I'd like to know if I'm using the right equivalents of Python3 and any great examples on how to use these modules.
So far, just even getting Python3 to "get" the URL, pass authentication credentials on the website and to ignore SSL cert has been really hard and frustrating. I'm not getting anywhere with that.
The Perl script accesses Cisco's Call Manager (phone system) webpage (https, authenication, ignore SSL), it pulls data off the pages, may be more than one with up to 2000 line items on each page. It then parses it (XML) into two columns, userID and extensions, and dumps it into a .CSV file. It then reads that .CSV file, accesses Microsoft Active Directory, looks up the userID and puts the extension of that userID into the persons Active Directory profile under the ipPhone attribute.
The modules the Perl script uses are below vs what I've been trying to use in Python3...
Net::LDAP; = python3-ldap3
LWP::UserAgent; = urllib3
LWP::Protocol::https; = requests
XML::Simple; = lxml
Any help would be appreciated. I'd like to know if I'm using the right equivalents of Python3 and any great examples on how to use these modules.
So far, just even getting Python3 to "get" the URL, pass authentication credentials on the website and to ignore SSL cert has been really hard and frustrating. I'm not getting anywhere with that.