pyvikunja 0.7__tar.gz → 0.8__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pyvikunja
3
- Version: 0.7
3
+ Version: 0.8
4
4
  Summary: A Python wrapper for Vikunja API
5
5
  Author: Joseph Shufflebotham
6
6
  License: AGPL
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pyvikunja"
7
- version = "0.7"
7
+ version = "0.8"
8
8
  description = "A Python wrapper for Vikunja API"
9
9
  authors = [
10
10
  {name = "Joseph Shufflebotham"}
@@ -74,6 +74,22 @@ class VikunjaAPI:
74
74
  logger.error(f"Unexpected error occurred: {e} | URL: {url}")
75
75
  return None
76
76
 
77
+ async def ping(self) -> bool:
78
+ """Tests if the API key is valid by calling the /projects endpoint."""
79
+ """Not chosen the /user endpoint here because it was always returning 401 with an API Token"""
80
+ url = f"{self.api_base_url}/projects"
81
+
82
+ try:
83
+ response = await self.client.get(url, headers=self.headers, timeout=10)
84
+ response.raise_for_status()
85
+
86
+ if response.status_code == 200:
87
+ return True
88
+ else:
89
+ raise httpx.HTTPError(f"Non-200 Response from server {response.status_code}")
90
+ except httpx.HTTPError as e:
91
+ raise e
92
+
77
93
  # Projects
78
94
  async def get_projects(self, page: int = 1, per_page: int = 20) -> List[Project]:
79
95
  response = await self._request("GET", "/projects", params={"page": page, "per_page": per_page})
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pyvikunja
3
- Version: 0.7
3
+ Version: 0.8
4
4
  Summary: A Python wrapper for Vikunja API
5
5
  Author: Joseph Shufflebotham
6
6
  License: AGPL
File without changes
File without changes
File without changes
File without changes