Skip to content

Commit

Permalink
Upgrade to 1.0.5 and remove logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ari committed Jan 31, 2018
1 parent 5ba191a commit ad2e126
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
4 changes: 4 additions & 0 deletions HISTORY.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
8 changes: 0 additions & 8 deletions moneyworks/moneyworks.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
#!python3

import configparser
import logging
import urllib.error
import urllib.parse
import urllib.request
from xml.etree.ElementTree import fromstring
import requests
from requests.auth import HTTPBasicAuth

logging.basicConfig(format='%(message)s', level=logging.WARNING)


class Moneyworks:

Expand Down Expand Up @@ -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):
Expand All @@ -76,15 +71,13 @@ 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):
"""
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):
Expand All @@ -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):
Expand Down
5 changes: 0 additions & 5 deletions moneyworks/transaction.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -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 = '<?xml version="1.0"?>' + tostring(xml, encoding="unicode")
logging.info(output)
return output

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/',
Expand Down

0 comments on commit ad2e126

Please sign in to comment.