title: how do i get the number of clients from an Ap cisco and save it in a variable?
body: <p>I hope you can help me,
  The goal is to get the number of clients that have conected to the ap using pysnmp, I think I'm close, I know I have to use probably pyasn1, but I get to a part that gives me the following error:</p>
  
  <p><strong>('---------->', DisplayString('', subtypeSpec=ConstraintsIntersection(ConstraintsIntersection(ConstraintsIntersection(ConstraintsIntersection(),ValueSizeConstraint(0, 255)),ValueSizeConstraint(0, 255))))</strong></p>
  
  <p>My code is this:</p>
  
  <pre><code>from pysnmp.hlapi import *
  from pysnmp.proto import rfc1905
  
  setcommunity = "public"
  host = "192.168.1.51"
  oid = '1.3.6.1.4.1.1.4.1.14179.2.1.1.1.38'
  ssid = "Cisco1852i"
  snmp_engine = SnmpEngine()
  
  #this function gets the interface status of the cisco Switch
  
  def show_apClients():
         clients = nextCmd (snmp_engine,
                 CommunityData(setcommunity),
                 UdpTransportTarget((host, 161)),
                 ContextData(),
  
         ObjectType(ObjectIdentity('SNMPv2-SMI', 'mib-2', '1.3.6.1.4.1.14179.2.1.1.1.38')))
         errorIndication, errorStatus, errorIndex, varBinds = next(clients) 
         numberClients = varBinds[0][1]
         print("-----------&gt;", numberClients)
         return numberClients
  
  nClients = show_apClients()
  
  print(".....-------&gt;", nClients)
  </code></pre>
  
  <p>I think the OID, the MIB and the rest are all right, because I through the command:</p>
  
  <p>"<em>sudo snmpwalk.py -v 2c -c public 192.168.1.51 1.3.6.1.4.1.14179.2.1.4.1.7 | wc -l</em>" </p>
  
  <p>or</p>
  
  <p>"<em>sudo snmpwalk.py -v 2c -c public 192.168.1.51 1.3.6.1.4.1.14179.2.1.1.18</em>"
  I can get the command line the number of clients</p>