Compare commits

...

3 Commits

Author SHA1 Message Date
855f9b652d Handle Byte Order Mark (BOM) in CSVs 2022-05-31 12:37:11 -04:00
69bcb71091 Get all types of transaction 2022-05-31 12:37:11 -04:00
63bd8efaf2 Bump dependencies 2022-05-31 12:37:05 -04:00
3 changed files with 816 additions and 462 deletions

View File

@ -197,6 +197,10 @@ class MembershipWorks:
) )
if r.status_code != 200: if r.status_code != 200:
raise MembershipWorksRemoteError("csv generation", r) raise MembershipWorksRemoteError("csv generation", r)
if r.text[0] == "\ufeff":
r.encoding = r.encoding + "-sig"
return list(csv.DictReader(StringIO(r.text))) return list(csv.DictReader(StringIO(r.text)))
def get_transactions(self, start_date, end_date, json=False): def get_transactions(self, start_date, end_date, json=False):
@ -210,7 +214,7 @@ class MembershipWorks:
r = self._get_v1( r = self._get_v1(
BASE_URL + "/v1/csv", BASE_URL + "/v1/csv",
params={ params={
"crm": "12,13,14,18,19", # transaction types, see CRM "crm": ",".join(str(k) for k in CRM.keys()),
**({"txl": ""} if json else {}), **({"txl": ""} if json else {}),
"sdp": start_date.strftime("%s"), "sdp": start_date.strftime("%s"),
"edp": end_date.strftime("%s"), "edp": end_date.strftime("%s"),
@ -221,6 +225,9 @@ class MembershipWorks:
if json: if json:
return r.json() return r.json()
else: else:
if r.text[0] == "\ufeff":
r.encoding = r.encoding + "-sig"
return list(csv.DictReader(StringIO(r.text))) return list(csv.DictReader(StringIO(r.text)))
def get_all_members(self): def get_all_members(self):

1259
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -17,16 +17,16 @@ authors = ["Adam Goldsmith <adam@adamgoldsmith.name>"]
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.7" python = "^3.7"
requests = "^2.23.0" requests = "^2.23.0"
"ruamel.yaml" = "^0.16.10" "ruamel.yaml" = "^0.17.20"
bitstring = "^3.1.6" bitstring = "^3.1.6"
lxml = "^4.5.0" lxml = "^4.5.0"
peewee = "^3.13.2" peewee = "^3.13.2"
mysqlclient = "^1.4.6" mysqlclient = "^2.1.0"
udm-rest-client = "^0.4.0" udm-rest-client = "^1.0.6"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
black = "^19.10b0" black = "^22.3.0"
isort = "^4.3.21" isort = "^5.10.1"
[tool.poetry.scripts] [tool.poetry.scripts]
doorUpdater = 'memberPlumbing.doorUpdater:main' doorUpdater = 'memberPlumbing.doorUpdater:main'