codemie-sdk-python 0.1.93__py3-none-any.whl → 0.1.94__py3-none-any.whl

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.

Potentially problematic release.


This version of codemie-sdk-python might be problematic. Click here for more details.

@@ -1,5 +1,7 @@
1
1
  """Authentication credentials module for CodeMie SDK."""
2
2
 
3
+ import os
4
+
3
5
  import requests
4
6
  from typing import Optional
5
7
 
@@ -36,13 +38,17 @@ class KeycloakCredentials:
36
38
  self.password = password
37
39
  self.verify_ssl = verify_ssl
38
40
 
39
- if not ((client_id and client_secret) or (username and password)):
41
+ if os.getenv("ENV", "").lower() != "local" and not (
42
+ (client_id and client_secret) or (username and password)
43
+ ):
40
44
  raise ValueError(
41
45
  "Either client credentials (client_id, client_secret) or "
42
46
  "user credentials (username, password) must be provided"
43
47
  )
44
48
 
45
49
  def get_token(self) -> str:
50
+ if os.getenv("ENV", "").lower() == "local":
51
+ return ""
46
52
  """Get access token using either client credentials or password grant."""
47
53
  url = (
48
54
  f"{self.server_url}/realms/{self.realm_name}/protocol/openid-connect/token"
codemie_sdk/utils/http.py CHANGED
@@ -1,5 +1,6 @@
1
1
  """HTTP utilities for CodeMie SDK."""
2
2
 
3
+ import os
3
4
  from typing import TypeVar, Type, Optional, Any, Union, Dict, List, get_origin, get_args
4
5
  from pydantic import BaseModel
5
6
  import requests
@@ -56,14 +57,11 @@ class ApiRequestHandler:
56
57
  if not exclude_content_type:
57
58
  headers["Content-Type"] = "application/json"
58
59
 
59
- if (
60
- "0.0.0.0" in self._base_url
61
- or "127.0.0.1" in self._base_url
62
- or "localhost" in self._base_url
63
- ):
64
- headers["User-Id"] = "dev-codemie-user"
65
- else:
66
- headers["Authorization"] = f"Bearer {self._token}"
60
+ headers["Authorization"] = (
61
+ f"Bearer {self._token}"
62
+ if os.getenv("ENV", "").lower() != "local"
63
+ else "dev-codemie-user"
64
+ )
67
65
  return headers
68
66
 
69
67
  def _parse_response(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: codemie-sdk-python
3
- Version: 0.1.93
3
+ Version: 0.1.94
4
4
  Summary: CodeMie SDK for Python
5
5
  Author: Vadym Vlasenko
6
6
  Author-email: vadym_vlasenko@epam.com
@@ -841,16 +841,16 @@ AWS_SECRET_KEY=<aws_secret_key>
841
841
  RP_API_KEY=<report_portal_key_optional>
842
842
  ```
843
843
 
844
- Run all tests
844
+ Run all tests (-n - number of parallel workers. Fill free to change it to find the best that suits your environment)
845
845
 
846
846
  ```shell
847
- pytest -n auto --reruns 1
847
+ pytest -n 10 --reruns 2
848
848
  ```
849
849
 
850
850
  Run e2e/regression tests
851
851
 
852
852
  ```shell
853
- pytest -n auto -m "e2e or regression" --reruns 1
853
+ pytest -n 10 -m "e2e or regression" --reruns 2
854
854
  ```
855
855
 
856
856
  Run UI tests
@@ -863,7 +863,7 @@ playwright install
863
863
  and then
864
864
 
865
865
  ```shell
866
- pytest -n 4 -m ui --reruns 1
866
+ pytest -n 4 -m ui --reruns 2
867
867
  ```
868
868
 
869
869
  All Playwright documentation can be found by the following link: https://playwright.dev/python/docs/intro
@@ -878,13 +878,13 @@ Available marks:
878
878
  - git
879
879
 
880
880
  ```shell
881
- pytest -n auto -m "jira_kb or github" --reruns 1
881
+ pytest -n 10 -m "jira_kb or github" --reruns 2
882
882
  ```
883
883
 
884
884
  In case you want to send test results in **ReportPortal** you should specify RP_API_KEY in .env and run tests like this:
885
885
 
886
886
  ```shell
887
- pytest -n auto -m "e2e or regression" --reruns 1 --reportportal
887
+ pytest -n 10 -m "e2e or regression" --reruns 2 --reportportal
888
888
  ```
889
889
 
890
890
  ReportPortal link is available by the following URL: https://report-portal.core.kuberocketci.io/ui/#epm-cdme/launches/all
@@ -1,6 +1,6 @@
1
1
  codemie_sdk/__init__.py,sha256=leeACpTc2113BsY_IgO-ceFHPrQKC2WhuOfuuyyIqDE,567
2
2
  codemie_sdk/auth/__init__.py,sha256=IksEj223xEZtJ-cQ0AT9L0Bs9psIJ8QNzDXrPTUQ3xQ,126
3
- codemie_sdk/auth/credentials.py,sha256=u2eLNsD8fELTgreQghVb0g0kk82zchUkux0M5lzq-u8,4320
3
+ codemie_sdk/auth/credentials.py,sha256=vcvt2nvb4_tSCdR7On498wNW4D-DRIuEJU6l3QG8QN0,4471
4
4
  codemie_sdk/client/__init__.py,sha256=yf6C39MmrJ6gK9ZHMhBeynKwUUYVSUTQbKxU8-4qpKg,101
5
5
  codemie_sdk/client/client.py,sha256=dVcWqd-ruWd8GOZ3_33C3LnHgUyyxIoCKxKYPYbBPq8,4373
6
6
  codemie_sdk/exceptions.py,sha256=XoVPyognx-JmyVxLHkZPAcX1CMi1OoT1diBFJLU54so,1183
@@ -24,7 +24,7 @@ codemie_sdk/services/workflow.py,sha256=0d5grAsBIH2NZY66UbVhlDqEFYxEYSBByj3GNgcz
24
24
  codemie_sdk/services/workflow_execution.py,sha256=aGoT3rdTmh5-doAsrmBBjLEuOfvL5aqeo3g9th1_aAw,3647
25
25
  codemie_sdk/services/workflow_execution_state.py,sha256=tXoaa8yT09xgYEUNiHhVULe76TwGwVgZupMIUyyLxdo,2070
26
26
  codemie_sdk/utils/__init__.py,sha256=BXAJJfAzO89-kMYvWWo9wSNhSbGgF3vB1In9sePFhMM,109
27
- codemie_sdk/utils/http.py,sha256=FWU56W_-vBGbHfX1EC1zsoRjDoNCyNK2HCdNb4IkQVc,9233
28
- codemie_sdk_python-0.1.93.dist-info/METADATA,sha256=0fpgPx3JfUa1R9f6lxJ09GW9Q5aOgcsQBTQ9cStdmRA,23620
29
- codemie_sdk_python-0.1.93.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
30
- codemie_sdk_python-0.1.93.dist-info/RECORD,,
27
+ codemie_sdk/utils/http.py,sha256=sdUdMYtexkYz0dQ7ysdwJlyYaE-QHdTZekQNDJpX48s,9134
28
+ codemie_sdk_python-0.1.94.dist-info/METADATA,sha256=Hc9jLqdXc1WhfJIVcId_zQb7Z7xscEgjjRE94MPxgrU,23715
29
+ codemie_sdk_python-0.1.94.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
30
+ codemie_sdk_python-0.1.94.dist-info/RECORD,,