Handle Byte Order Mark (BOM) in CSVs
This commit is contained in:
parent
69bcb71091
commit
855f9b652d
@ -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):
|
||||||
@ -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):
|
||||||
|
Reference in New Issue
Block a user