Repository: mbillow/python-redpocket

Issue:
Retrieve quicker updating data
I found that when retrieving data from the `/get-details` endpoint, it appeared to update quicker when `type=api` was included. Without it, the data retrieved appeared to be cached.  There was an increase in response time as a side effect, but I took this as a good sign.

Call: ```https://www.redpocket.com/account/get-details?id=AAA1BBB2&type=api```
Instead of: ```https://www.redpocket.com/account/get-details?id=AAA1BBB2```

Discussion:

Patch:
diff --git a/redpocket/api.py b/redpocket/api.py
index a69964e..f20da88 100644
--- a/redpocket/api.py
+++ b/redpocket/api.py
@@ -204,12 +204,15 @@ class RedPocket:
         self,
         method: str = "get",
         url: str = "",
+        params: dict = None,
         data: dict = None,
         _is_retry: bool = False,
     ) -> requests.Response:
         self._logger.debug("API Request: [%s] URL: %s", method.upper(), url)
 
-        request = self._session.request(method=method, url=url, data=data)
+        request = self._session.request(
+            method=method, url=url, params=params, data=data
+        )
         if request.status_code != requests.codes.ok:
             raise RedPocketAPIError("API Returned Non-200 Response!")
 
@@ -241,8 +244,13 @@ class RedPocket:
         ]
 
     def get_line_details(self, account_hash: str) -> RedPocketLineDetails:
+        params = {
+            "id": account_hash,
+            "type": "api",
+        }
         details = self.request(
-            url=f"https://www.redpocket.com/account/get-details?id={account_hash}"
+            url="https://www.redpocket.com/account/get-details",
+            params=params,
         )
         details_json = details.json()
         return RedPocketLineDetails.from_api(


Test patch:
diff --git a/tests/test_api.py b/tests/test_api.py
index caf6de1..3cce41d 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -134,7 +134,7 @@ def test_get_line_details(
     )
     responses.add(
         responses.GET,
-        "https://www.redpocket.com/account/get-details?id=MTIzNDU2",
+        "https://www.redpocket.com/account/get-details?id=MTIzNDU2&type=api",
         status=200,
         json={"return_code": 1, "return_data": mock_line_details},
     )
@@ -157,7 +157,7 @@ def test_get_all_line_details(
     )
     responses.add(
         responses.GET,
-        "https://www.redpocket.com/account/get-details?id=MTIzNDU2",
+        "https://www.redpocket.com/account/get-details?id=MTIzNDU2&type=api",
         status=200,
         json={"return_code": 1, "return_data": mock_line_details},
     )