diff --git a/civicrmapi4/civicrmapi4.py b/civicrmapi4/civicrmapi4.py index 62b0082..6efcc2e 100644 --- a/civicrmapi4/civicrmapi4.py +++ b/civicrmapi4/civicrmapi4.py @@ -6,12 +6,11 @@ import logging from typing import List, Optional, Dict, Union -from bs4 import BeautifulSoup - log = logging.getLogger(__name__) +# # TODOs and FIXMEs # # * come up with a better way to specify `where` clauses. @@ -75,7 +74,7 @@ class APIv4: """ self.session = requests.Session() - ### Perform login post + # Perform login post self.session.cookies.update({"has_js": "1"}) postdata = { "name": user, @@ -118,7 +117,7 @@ class APIv4: url = self.api_url+'/'+objName+'/'+action if params: - result = self.session.post(url, params={'params':json.dumps(params)}, data="") + result = self.session.post(url, params={'params': json.dumps(params)}, data="") else: result = self.session.post(url, data="") if (not result.ok): @@ -188,7 +187,11 @@ class APIv4: return [x["name"] for x in ent] - def get(self, objName: str, where: Optional[List]=None, limit: Optional[int]=None, select=Optional[List[str]]) -> List: + def get(self, + objName: str, + where: Optional[List] = None, + limit: Optional[int] = None, + select=Optional[List[str]]) -> List: """ Get objects based on a where clause, optional limit and optional field list. @@ -207,7 +210,7 @@ class APIv4: params["limit"] = limit if where is not None: params["where"] = where - if columns is not None and columns: + if select is not None and select: params["select"] = select return self.call_values(objName, "get", params=params) diff --git a/pyproject.toml b/pyproject.toml index 118495b..4d957ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] requires = ["setuptools", "wheel"] -build-backend = "setuptools-build_meta" + diff --git a/tox.ini b/tox.ini index 7507b81..bd91f61 100644 --- a/tox.ini +++ b/tox.ini @@ -1,3 +1,15 @@ +[tox] +envlist = py36, py37, py38, py39 + +[testenv] +deps = + flake8 + mypy +commands = + flake8 + mypy civicrmapi4 + + [flake8] max-line-length = 120 max-complexity = 20