cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2699
Views
0
Helpful
2
Replies

urlopen error [dh key too small] with python suds client for perfmon api

zerocool443
Cisco Employee
Cisco Employee

So i am using this scripts that uses perfmon api to fetch counters/details from call manager. 

 

Some details about the script.

Python 3.x

Libs: suds-jurko, ssl

API: perfmon api 

 

----------------------------------------------------------------------------------------

 

The script works perfectly fine on my lab cucm. but when i test this with another labs it gives me following errors.

 

urllib.error.URLError: <urlopen error [SSL: SSL_NEGATIVE_LENGTH] dh key too small (_ssl.c:777)>

 

Code snippet:

 

 

from suds.client import Client
from suds.xsd.doctor import Import
from suds.xsd.doctor import ImportDoctor
import logging
import ssl

ssl._create_default_https_context = ssl._create_unverified_context
wsdl = 'https://10.106.79.98:8443/perfmonservice2/services/PerfmonService?wsdl'
location = 'https://10.106.79.98:8443/perfmonservice2/services/PerfmonService'
username = test
password = test
tns = 'http://schemas.cisco.com/ast/soap/'
imp = Import('http://schemas.xmlsoap.org/soap/encoding/',
'http://schemas.xmlsoap.org/soap/encoding/')
imp.filter.add(tns)
client = Client(wsdl, location=location, faults=False, plugins=[ImportDoctor(imp)], username=username,password=password)

perfmon_objects_1 = ['AnnunciatorResourceTotal', 'MOHTotalMulticastResources', 'MTPResourceAvailable',
'SWConferenceResourceAvailable', 'RegisteredHardwarePhones', 'TLSConnectedSIPTrunks', ]

res = client.service.perfmonCollectCounterData(node_name, 'Cisco CallManager')

print('CALL MANAGER Resources')
for node in res[1]:
counter_name=(str(node['Name'].split('\\')[4]))
if(counter_name in perfmon_objects_1):
print(counter_name)
print(str(node['Value']))

 

2 Replies 2

Chris Deren
Hall of Fame
Hall of Fame

Did you ever find a solution to this by any chance?

hey chris,

 

The code worked on py 3.4.

I was developing the script on py 2.7 earlier.

 

As per the understanding py 3.4 implementation of urlopen either ignores those alerts or doesn't use those key sharing algorithms.  

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: