easy-acumatica 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- easy_acumatica-0.1.0/LICENSE +0 -0
- easy_acumatica-0.1.0/PKG-INFO +17 -0
- easy_acumatica-0.1.0/README.md +1 -0
- easy_acumatica-0.1.0/pyproject.toml +23 -0
- easy_acumatica-0.1.0/setup.cfg +4 -0
- easy_acumatica-0.1.0/src/easy_acumatica/__init__.py +4 -0
- easy_acumatica-0.1.0/src/easy_acumatica/client.py +35 -0
- easy_acumatica-0.1.0/src/easy_acumatica/contacts.py +17 -0
- easy_acumatica-0.1.0/src/easy_acumatica.egg-info/PKG-INFO +17 -0
- easy_acumatica-0.1.0/src/easy_acumatica.egg-info/SOURCES.txt +12 -0
- easy_acumatica-0.1.0/src/easy_acumatica.egg-info/dependency_links.txt +1 -0
- easy_acumatica-0.1.0/src/easy_acumatica.egg-info/requires.txt +1 -0
- easy_acumatica-0.1.0/src/easy_acumatica.egg-info/top_level.txt +1 -0
- easy_acumatica-0.1.0/tests/test_core.py +11 -0
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: easy_acumatica
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python wrapper for the Acumatica REST API
|
|
5
|
+
Author-email: Matthew Hirstius <matthew.c.hirstius@gmail.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/Nioron07/Easy-Acumatica
|
|
7
|
+
Project-URL: Source, https://github.com/Nioron07/Easy-Acumatica
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.7
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: requests>=2.25.1
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
|
|
17
|
+
# Easy-Acumatica
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Easy-Acumatica
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "easy_acumatica"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python wrapper for the Acumatica REST API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [{ name="Matthew Hirstius", email="matthew.c.hirstius@gmail.com" }]
|
|
11
|
+
requires-python = ">=3.7"
|
|
12
|
+
dependencies = [
|
|
13
|
+
"requests>=2.25.1"
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: OS Independent"
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
"Homepage" = "https://github.com/Nioron07/Easy-Acumatica"
|
|
23
|
+
"Source" = "https://github.com/Nioron07/Easy-Acumatica"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
from .contacts import ContactsService
|
|
3
|
+
class AcumaticaClient:
|
|
4
|
+
def __init__(self, base_url, username, password,
|
|
5
|
+
tenant, branch, locale=None,
|
|
6
|
+
verify_ssl=True):
|
|
7
|
+
self.base_url = base_url.rstrip('/')
|
|
8
|
+
self.session = requests.Session()
|
|
9
|
+
self.verify_ssl = verify_ssl
|
|
10
|
+
self.login_payload = {
|
|
11
|
+
"name": username,
|
|
12
|
+
"password": password,
|
|
13
|
+
"tenant": tenant,
|
|
14
|
+
"branch": branch,
|
|
15
|
+
}
|
|
16
|
+
self.contacts = ContactsService(self)
|
|
17
|
+
if locale:
|
|
18
|
+
self.login_payload["locale"] = locale
|
|
19
|
+
|
|
20
|
+
def login(self):
|
|
21
|
+
url = f"{self.base_url}/auth/login"
|
|
22
|
+
resp = self.session.post(
|
|
23
|
+
url,
|
|
24
|
+
json=self.login_payload,
|
|
25
|
+
verify=self.verify_ssl
|
|
26
|
+
)
|
|
27
|
+
resp.raise_for_status()
|
|
28
|
+
return resp.status_code
|
|
29
|
+
|
|
30
|
+
def logout(self):
|
|
31
|
+
url = f"{self.base_url}/auth/logout"
|
|
32
|
+
resp = self.session.post(url, verify=self.verify_ssl)
|
|
33
|
+
resp.raise_for_status()
|
|
34
|
+
self.session.cookies.clear()
|
|
35
|
+
return resp.status_code
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# src/easy_acumatica/contacts.py
|
|
2
|
+
from typing import Any, Dict, Optional
|
|
3
|
+
from .client import AcumaticaClient
|
|
4
|
+
|
|
5
|
+
class ContactsService:
|
|
6
|
+
def __init__(self, client: AcumaticaClient):
|
|
7
|
+
self._client = client
|
|
8
|
+
|
|
9
|
+
def get_contacts(self, api_version: str, params: Optional[Dict[str, Any]] = None) -> Any:
|
|
10
|
+
"""
|
|
11
|
+
Fetch the list of contacts.
|
|
12
|
+
`params` can include filters like ?$filter=…
|
|
13
|
+
"""
|
|
14
|
+
url = f"{self._client.base_url}/entity/Default/{api_version}/Contact"
|
|
15
|
+
resp = self._client.session.get(url, params=params, verify=self._client.verify_ssl)
|
|
16
|
+
resp.raise_for_status()
|
|
17
|
+
return resp.json()
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: easy_acumatica
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python wrapper for the Acumatica REST API
|
|
5
|
+
Author-email: Matthew Hirstius <matthew.c.hirstius@gmail.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/Nioron07/Easy-Acumatica
|
|
7
|
+
Project-URL: Source, https://github.com/Nioron07/Easy-Acumatica
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.7
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: requests>=2.25.1
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
|
|
17
|
+
# Easy-Acumatica
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/easy_acumatica/__init__.py
|
|
5
|
+
src/easy_acumatica/client.py
|
|
6
|
+
src/easy_acumatica/contacts.py
|
|
7
|
+
src/easy_acumatica.egg-info/PKG-INFO
|
|
8
|
+
src/easy_acumatica.egg-info/SOURCES.txt
|
|
9
|
+
src/easy_acumatica.egg-info/dependency_links.txt
|
|
10
|
+
src/easy_acumatica.egg-info/requires.txt
|
|
11
|
+
src/easy_acumatica.egg-info/top_level.txt
|
|
12
|
+
tests/test_core.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests>=2.25.1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
easy_acumatica
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from easy_acumatica import AcumaticaClient
|
|
3
|
+
|
|
4
|
+
@pytest.fixture
|
|
5
|
+
def client(monkeypatch):
|
|
6
|
+
# monkeypatch a requests.Session or use requests-mock
|
|
7
|
+
return AcumaticaClient("https://fake", "u", "p", "t", "b")
|
|
8
|
+
|
|
9
|
+
def test_login_success(client, requests_mock):
|
|
10
|
+
requests_mock.post("https://fake/auth/login", status_code=204)
|
|
11
|
+
assert client.login() == 204
|