lynkora-sdk-python 0.1.0__tar.gz → 0.2.1__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.4
2
2
  Name: lynkora-sdk-python
3
- Version: 0.1.0
3
+ Version: 0.2.1
4
4
  Summary: SDK Python para integração com a API de Actions/Subscribers do Lynkora Admin Service.
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://docs.lynkora.dev/docs/para-desenvolvedores/sdks
@@ -38,7 +38,7 @@ from lynkora_sdk import LynkoraClient
38
38
 
39
39
  lynkora = LynkoraClient(
40
40
  api_key=os.environ["LYNKORA_API_KEY"],
41
- base_url="https://api.lynkora.dev",
41
+ # base_url é opcional — default "https://api.lynkora.dev"
42
42
  )
43
43
 
44
44
  result = lynkora.consume_action(
@@ -20,7 +20,7 @@ from lynkora_sdk import LynkoraClient
20
20
 
21
21
  lynkora = LynkoraClient(
22
22
  api_key=os.environ["LYNKORA_API_KEY"],
23
- base_url="https://api.lynkora.dev",
23
+ # base_url é opcional — default "https://api.lynkora.dev"
24
24
  )
25
25
 
26
26
  result = lynkora.consume_action(
@@ -4,9 +4,11 @@ from urllib.request import Request, urlopen
4
4
 
5
5
  from .errors import LynkoraApiError
6
6
 
7
+ DEFAULT_BASE_URL = "https://api.lynkora.dev"
8
+
7
9
 
8
10
  class LynkoraClient:
9
- def __init__(self, api_key: str, base_url: str) -> None:
11
+ def __init__(self, api_key: str, base_url: str = DEFAULT_BASE_URL) -> None:
10
12
  self._api_key = api_key
11
13
  self._base_url = base_url
12
14
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lynkora-sdk-python
3
- Version: 0.1.0
3
+ Version: 0.2.1
4
4
  Summary: SDK Python para integração com a API de Actions/Subscribers do Lynkora Admin Service.
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://docs.lynkora.dev/docs/para-desenvolvedores/sdks
@@ -38,7 +38,7 @@ from lynkora_sdk import LynkoraClient
38
38
 
39
39
  lynkora = LynkoraClient(
40
40
  api_key=os.environ["LYNKORA_API_KEY"],
41
- base_url="https://api.lynkora.dev",
41
+ # base_url é opcional — default "https://api.lynkora.dev"
42
42
  )
43
43
 
44
44
  result = lynkora.consume_action(
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "lynkora-sdk-python"
3
- version = "0.1.0"
3
+ version = "0.2.1"
4
4
  description = "SDK Python para integração com a API de Actions/Subscribers do Lynkora Admin Service."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.9"
@@ -98,3 +98,13 @@ def test_network_error_propagates_unwrapped(client: LynkoraClient) -> None:
98
98
  with patch("lynkora_sdk.client.urlopen", side_effect=URLError("no route")):
99
99
  with pytest.raises(URLError):
100
100
  client.consume_action(subscriber_id="sub-1", action_slug="sign_document")
101
+
102
+
103
+ def test_defaults_to_production_api_when_base_url_is_omitted() -> None:
104
+ default_client = LynkoraClient(api_key=API_KEY)
105
+ fake = FakeResponse(201, b'{"reservationId": "res-1", "quantity": 1}')
106
+ with patch("lynkora_sdk.client.urlopen", return_value=fake) as urlopen_mock:
107
+ default_client.consume_action(subscriber_id="sub-1", action_slug="sign_document")
108
+
109
+ req = urlopen_mock.call_args[0][0]
110
+ assert req.full_url == "https://api.lynkora.dev/v1/actions/consume"