From ad2e126677fd8358f169aaae116dc2f5ab2f9552 Mon Sep 17 00:00:00 2001 From: Aristedes Maniatis Date: Thu, 1 Feb 2018 10:17:45 +1100 Subject: [PATCH] Upgrade to 1.0.5 and remove logging --- HISTORY.txt | 4 ++++ moneyworks/moneyworks.py | 8 -------- moneyworks/transaction.py | 5 ----- setup.py | 2 +- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/HISTORY.txt b/HISTORY.txt index 6224939..eb07d5c 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -1,3 +1,7 @@ +# version 1.0.5 (1 Feb 2018) + +Remove logging since it interferes with this library being used in salt + # version 1.0.4 (31 Jan 2018) Rename package to moneyworks and fix some pip packaging issues. diff --git a/moneyworks/moneyworks.py b/moneyworks/moneyworks.py index 1901e6b..639c7db 100644 --- a/moneyworks/moneyworks.py +++ b/moneyworks/moneyworks.py @@ -1,7 +1,6 @@ #!python3 import configparser -import logging import urllib.error import urllib.parse import urllib.request @@ -9,8 +8,6 @@ import requests from requests.auth import HTTPBasicAuth -logging.basicConfig(format='%(message)s', level=logging.WARNING) - class Moneyworks: @@ -55,9 +52,7 @@ def create_transaction(self, xml): :param xml: the XML data fragment for this transaction :return sequence number of the record created """ - logging.info(xml) seqnum = self.__post("import/return_seq=true", xml).text - logging.warning("Transaction created with id " + seqnum) return seqnum def get_email(self, company_code): @@ -76,7 +71,6 @@ def print_transaction(self, search, form): :return the pdf file as bytes """ r = self.__get("doform/form=" + form + "&search=" + urllib.parse.quote_plus(search)) - logging.debug(r.headers) return r.content def post_transaction(self, seqnum): @@ -84,7 +78,6 @@ def post_transaction(self, seqnum): Post the transaction in Moneyworks :param seqnum the invoice's sequence number (this is not the same as the invoice/PO number) """ - logging.warning("Posting transaction " + seqnum) return self.__post("post/seqnum=" + seqnum, "").text def export(self, table, search): @@ -96,7 +89,6 @@ def export(self, table, search): """ path = "export/table=" + table + "&search=" + urllib.parse.quote_plus(search) + "&format=xml-verbose" xml = self.__get(path).text - logging.debug("XML retrieved " + xml) result = [] for record in fromstring(xml).findall(table): diff --git a/moneyworks/transaction.py b/moneyworks/transaction.py index 0319224..b31d105 100644 --- a/moneyworks/transaction.py +++ b/moneyworks/transaction.py @@ -1,12 +1,8 @@ #!python3 -import logging from datetime import date from xml.etree.ElementTree import Element, SubElement, tostring -logging.basicConfig(format='%(message)s', level=logging.WARNING) - - class Transaction: def __init__(self): @@ -48,7 +44,6 @@ def to_xml(self): # hardcode in gross to appear at the end since MW requires it SubElement(transaction, "gross", {"work-it-out": "true"}) output = '' + tostring(xml, encoding="unicode") - logging.info(output) return output @staticmethod diff --git a/setup.py b/setup.py index 72896a3..841406c 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='moneyworks', - version='1.0.4', + version='1.0.5', description='A python API for Cognito Moneyworks accounting software', long_description='A python API for Cognito Moneyworks accounting software', url='http://github.com/ari/moneyworks-cli/',