本文整理汇总了Python中pysimplesoap.client.SoapClient.dummy方法的典型用法代码示例。如果您正苦于以下问题:Python SoapClient.dummy方法的具体用法?Python SoapClient.dummy怎么用?Python SoapClient.dummy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pysimplesoap.client.SoapClient
的用法示例。
在下文中一共展示了SoapClient.dummy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_wscoc_dummy
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import dummy [as 别名]
def test_wscoc_dummy(self):
"""Test Argentina AFIP Foreign Exchange Control WSCOC dummy method"""
client = SoapClient(
wsdl="https://fwshomo.afip.gov.ar/wscoc/COCService?wsdl",
cache=None, ns='ser'
)
result = client.dummy()['dummyReturn']
self.assertEqual(result['appserver'], "OK")
self.assertEqual(result['dbserver'], "OK")
self.assertEqual(result['authserver'], "OK")
示例2: test_wsmtxca_dummy
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import dummy [as 别名]
def test_wsmtxca_dummy(self):
"""Test Argentina AFIP Electronic Invoice WSMTXCA dummy method"""
client = SoapClient(
wsdl="https://fwshomo.afip.gov.ar/wsmtxca/services/MTXCAService?wsdl",
cache=None, ns='ser'
)
result = client.dummy()
self.assertEqual(result['appserver'], "OK")
self.assertEqual(result['dbserver'], "OK")
self.assertEqual(result['authserver'], "OK")
示例3: __init__
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import dummy [as 别名]
class WSCTG11:
"Interfaz para el WebService de Código de Trazabilidad de Granos"
_public_methods_ = ['Conectar', 'Dummy',
'SolicitarCTGInicial', 'SolicitarCTGDatoPendiente',
'ConfirmarArribo', 'ConfirmarDefinitivo',
'AnularCTG', 'RechazarCTG',
'ConsultarCTG', 'LeerDatosCTG', 'ConsultarDetalleCTG',
'ConsultarCTGExcel', 'ConsultarConstanciaCTGPDF',
'ConsultarProvincias',
'ConsultarLocalidadesPorProvincia',
'ConsultarEstablecimientos',
'ConsultarCosechas',
'ConsultarEspecies',
'AnalizarXml', 'ObtenerTagXml',
]
_public_attrs_ = ['Token', 'Sign', 'Cuit',
'AppServerStatus', 'DbServerStatus', 'AuthServerStatus',
'Excepcion', 'ErrCode', 'ErrMsg', 'LanzarExcepciones', 'Errores',
'XmlRequest', 'XmlResponse', 'Version', 'Traceback',
'NumeroCTG', 'CartaPorte', 'FechaHora', 'CodigoOperacion',
'CodigoTransaccion', 'Observaciones', 'Controles', 'DatosCTG',
'VigenciaHasta', 'VigenciaDesde', 'Estado', 'ImprimeConstancia',
'TarifaReferencia',
]
_reg_progid_ = "WSCTG11"
_reg_clsid_ = "{ACDEFB8A-34E1-48CF-94E8-6AF6ADA0717A}"
def __init__(self):
self.Token = self.Sign = self.Cuit = None
self.AppServerStatus = self.DbServerStatus = self.AuthServerStatus = None
self.XmlRequest = ''
self.XmlResponse = ''
self.LanzarExcepciones = False
self.InstallDir = INSTALL_DIR
self.CodError = self.DescError = ''
self.client = None
self.Version = "%s %s" % (__version__, HOMO and 'Homologación' or '')
self.NumeroCTG = ''
self.CodigoTransaccion = self.Observaciones = ''
self.Excepcion = self.Traceback = ""
@inicializar_y_capturar_excepciones
def Conectar(self, cache=None, url="", proxy=""):
"Establecer la conexión a los servidores de la AFIP"
if HOMO or not url: url = WSDL
if not cache or HOMO:
# use 'cache' from installation base directory
cache = os.path.join(self.InstallDir, 'cache')
proxy_dict = parse_proxy(proxy)
self.client = SoapClient(url,
wsdl=url, cache=cache,
trace='--trace' in sys.argv,
ns='ctg', soap_ns='soapenv',
exceptions=True, proxy=proxy_dict)
return True
def __analizar_errores(self, ret):
"Comprueba y extrae errores si existen en la respuesta XML"
if 'arrayErrores' in ret:
errores = ret['arrayErrores'] or []
self.Errores = [err['error'] for err in errores]
self.ErrCode = ' '.join(self.Errores)
self.ErrMsg = '\n'.join(self.Errores)
def __analizar_controles(self, ret):
"Comprueba y extrae controles si existen en la respuesta XML"
if 'arrayControles' in ret:
controles = ret['arrayControles']
self.Controles = ["%(tipo)s: %(descripcion)s" % ctl['control']
for ctl in controles]
@inicializar_y_capturar_excepciones
def Dummy(self):
"Obtener el estado de los servidores de la AFIP"
results = self.client.dummy()['response']
self.AppServerStatus = str(results['appserver'])
self.DbServerStatus = str(results['dbserver'])
self.AuthServerStatus = str(results['authserver'])
@inicializar_y_capturar_excepciones
def AnularCTG(self, carta_porte, ctg):
"Anular el CTG si se creó el mismo por error"
response = self.client.anularCTG(request=dict(
auth={
'token': self.Token, 'sign': self.Sign,
'cuitRepresentado': self.Cuit, },
datosAnularCTG={
'cartaPorte': carta_porte,
'ctg': ctg, }))['response']
datos = response.get('datosResponse')
self.__analizar_errores(response)
if datos:
self.CartaPorte = str(datos['cartaPorte'])
self.NumeroCTG = str(datos['CTG'])
self.FechaHora = str(datos['fechaHora'])
self.CodigoOperacion = str(datos['codigoOperacion'])
@inicializar_y_capturar_excepciones
def RechazarCTG(self, carta_porte, ctg, motivo):
"El Destino puede rechazar el CTG a través de la siguiente operatoria"
#.........这里部分代码省略.........
示例4: __init__
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import dummy [as 别名]
#.........这里部分代码省略.........
if wrapper:
Http = set_http_wrapper(wrapper)
self.Version = WSCOC.Version + " " + Http._wrapper_version
proxy_dict = parse_proxy(proxy)
location = LOCATION
if HOMO or not wsdl:
wsdl = WSDL
elif not wsdl.endswith("?wsdl") and wsdl.startswith("http"):
location = wsdl
wsdl += "?wsdl"
elif wsdl.endswith("?wsdl"):
location = wsdl[:-5]
if not cache or HOMO:
# use 'cache' from installation base directory
cache = os.path.join(self.InstallDir, 'cache')
self.__log("Conectando a wsdl=%s cache=%s proxy=%s" % (wsdl, cache, proxy_dict))
self.client = SoapClient(
wsdl = wsdl,
cache = cache,
proxy = proxy_dict,
ns="coc",
cacert=cacert,
soap_ns="soapenv",
soap_server="jbossas6",
trace = "--trace" in sys.argv)
# corrijo ubicación del servidor (http en el WSDL)
self.client.services['COCService']['ports']['COCServiceHttpSoap11Endpoint']['location'] = location
self.__log("Corrigiendo location=%s" % (location, ))
return True
@inicializar_y_capturar_excepciones
def Dummy(self):
"Obtener el estado de los servidores de la AFIP"
result = self.client.dummy()
ret = result['dummyReturn']
self.AppServerStatus = ret['appserver']
self.DbServerStatus = ret['dbserver']
self.AuthServerStatus = ret['authserver']
return True
@inicializar_y_capturar_excepciones
def GenerarSolicitudCompraDivisa(self, cuit_comprador, codigo_moneda,
cotizacion_moneda, monto_pesos,
cuit_representante, codigo_destino,
djai=None, codigo_excepcion_djai=None,
djas=None, codigo_excepcion_djas=None,
tipo=None, codigo=None,
):
"Generar una Solicitud de operación cambiaria"
if tipo and codigo:
referencia = {'tipo': tipo, 'codigo': codigo}
else:
referencia = None
res = self.client.generarSolicitudCompraDivisa(
authRequest={'token': self.Token, 'sign': self.Sign, 'cuitRepresentada': self.Cuit},
cuitComprador=cuit_comprador,
codigoMoneda=codigo_moneda,
cotizacionMoneda=cotizacion_moneda,
montoPesos=monto_pesos,
cuitRepresentante=cuit_representante,
codigoDestino=codigo_destino,
djai=djai, codigoExcepcionDJAI=codigo_excepcion_djai,
djas=djas, codigoExcepcionDJAS=codigo_excepcion_djas,
referencia=referencia,
)
示例5: __init__
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import dummy [as 别名]
#.........这里部分代码省略.........
msg = self.Log.getvalue()
# limpiar log
self.Log.close()
self.Log = None
else:
msg = u''
return msg
@inicializar_y_capturar_excepciones
def Conectar(self, cache=None, wsdl=None, proxy="", wrapper=None):
# cliente soap del web service
if wrapper:
Http = set_http_wrapper(wrapper)
self.Version = WSMTXCA.Version + " " + Http._wrapper_version
proxy_dict = parse_proxy(proxy)
if HOMO or not wsdl:
wsdl = WSDL
if not wsdl.endswith("?wsdl") and wsdl.startswith("http"):
wsdl += "?wsdl"
if not cache or HOMO:
# use 'cache' from installation base directory
cache = os.path.join(self.InstallDir, 'cache')
self.__log("Conectando a wsdl=%s cache=%s proxy=%s" % (wsdl, cache, proxy_dict))
self.client = SoapClient(
wsdl = wsdl,
cache = cache,
proxy = proxy_dict,
ns='ser',
trace = "--trace" in sys.argv)
return True
def Dummy(self):
"Obtener el estado de los servidores de la AFIP"
result = self.client.dummy()
self.AppServerStatus = result['appserver']
self.DbServerStatus = result['dbserver']
self.AuthServerStatus = result['authserver']
return True
def CrearFactura(self, concepto=None, tipo_doc=None, nro_doc=None, tipo_cbte=None, punto_vta=None,
cbt_desde=None, cbt_hasta=None, imp_total=None, imp_tot_conc=None, imp_neto=None,
imp_subtotal=None, imp_trib=None, imp_op_ex=None, fecha_cbte=None, fecha_venc_pago=None,
fecha_serv_desde=None, fecha_serv_hasta=None, #--
moneda_id=None, moneda_ctz=None, observaciones=None, caea=None, fch_venc_cae=None,
**kwargs
):
"Creo un objeto factura (interna)"
# Creo una factura electronica de exportación
fact = {'tipo_doc': tipo_doc, 'nro_doc': nro_doc,
'tipo_cbte': tipo_cbte, 'punto_vta': punto_vta,
'cbt_desde': cbt_desde, 'cbt_hasta': cbt_hasta,
'imp_total': imp_total, 'imp_tot_conc': imp_tot_conc,
'imp_neto': imp_neto,
'imp_subtotal': imp_subtotal, # 'imp_iva': imp_iva,
'imp_trib': imp_trib, 'imp_op_ex': imp_op_ex,
'fecha_cbte': fecha_cbte,
'fecha_venc_pago': fecha_venc_pago,
'moneda_id': moneda_id, 'moneda_ctz': moneda_ctz,
'concepto': concepto,
'observaciones': observaciones,
'cbtes_asoc': [],
'tributos': [],
'iva': [],
'detalles': [],
}
if fecha_serv_desde: fact['fecha_serv_desde'] = fecha_serv_desde