Fix import conf.py

This commit is contained in:
Mauricio Baeza 2020-01-24 10:02:24 -06:00
commit e94cda3577
6 changed files with 29 additions and 7 deletions

View File

@ -1 +1 @@
1.33.0
1.33.1

View File

@ -23,8 +23,6 @@ import lxml.etree as ET
import requests
from requests.exceptions import ConnectionError
from .conf import DEBUG, AUTH
LOG_FORMAT = '%(asctime)s - %(levelname)s - %(message)s'
LOG_DATE = '%d/%m/%Y %H:%M:%S'
@ -33,10 +31,16 @@ logging.addLevelName(logging.DEBUG, '\x1b[33mDEBUG\033[1;0m')
logging.addLevelName(logging.INFO, '\x1b[32mINFO\033[1;0m')
logging.basicConfig(level=logging.DEBUG, format=LOG_FORMAT, datefmt=LOG_DATE)
log = logging.getLogger(__name__)
logging.getLogger('requests').setLevel(logging.ERROR)
try:
from .conf import DEBUG, AUTH
except ImportError:
DEBUG = False
log.error('Need make conf.py')
TIMEOUT = 10

View File

@ -24,7 +24,7 @@
# ~ con una cuenta de reseller
DEBUG = True
DEBUG = False
AUTH = {

View File

@ -591,3 +591,16 @@ def xml_stamp(xml, auth, name):
result['uuid'] = pac.cfdi_uuid
result['fecha'] = pac.date_stamped
return result
def get_client_balance(auth, name):
if DEBUG:
return '-d'
pac = PACS[name]()
auth = {'usr': auth['USER'], 'pwd': auth['PASS']}
balance = pac.client_balance(auth)
if pac.error:
balance = '-e'
return balance

View File

@ -1025,7 +1025,12 @@ class Emisor(BaseModel):
if not auth:
return 'c/e'
return util.get_timbres(auth)
pac = Configuracion.get_('lst_pac').lower()
if pac:
result = utils.get_client_balance(auth, pac)
else:
result = util.get_timbres(auth)
return result
@classmethod
def get_regimenes(cls):

View File

@ -47,7 +47,7 @@ except ImportError:
DEBUG = DEBUG
VERSION = '1.33.0'
VERSION = '1.33.1'
EMAIL_SUPPORT = ('soporte@empresalibre.mx',)
TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION)