Skip to content

Commit

Permalink
1. added timeout 10 sec for responses
Browse files Browse the repository at this point in the history
2. added unwrapping for reg path
  • Loading branch information
khoroshevskyi committed Nov 21, 2024
1 parent cd335fa commit 9649c42
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format.


## [0.4.5] - 2024-11-21
### Added
- Function for unwrapping PEPhub registry path
- Timeout for requests

## [0.4.4] - 2024-08-21
### Fixed
- Project annotation model
Expand Down
2 changes: 1 addition & 1 deletion pephubclient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import coloredlogs

__app_name__ = "pephubclient"
__version__ = "0.4.4"
__version__ = "0.4.5"
__author__ = "Oleksandr Khoroshevskyi, Rafal Stepien"


Expand Down
10 changes: 10 additions & 0 deletions pephubclient/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def send_request(
headers=headers,
params=params,
json=json,
timeout=10,
)
if request_return.status_code == 401:
if (
Expand Down Expand Up @@ -160,6 +161,15 @@ def is_registry_path(input_string: str) -> bool:
return True


def unwrap_registry_path(input_string: str) -> RegistryPath:
"""
Unwrap registry path from string
:param str input_string: path to the PEP (or registry path)
:return RegistryPath: RegistryPath object
"""
return RegistryPath(**parse_registry_path(input_string))


def _build_filename(registry_path: RegistryPath) -> str:
"""
Takes query string and creates output filename to save the project to.
Expand Down
1 change: 0 additions & 1 deletion tests/test_manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

@pytest.mark.skip(reason="Manual test")
class TestViewsManual:

def test_get(self):
ff = PEPHubClient().view.get(
"databio",
Expand Down
1 change: 0 additions & 1 deletion tests/test_pephubclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ def test_is_registry_path(self, input_str, expected_output):


class TestSamples:

def test_get(self, mocker):
return_value = {
"genome": "phc_test1",
Expand Down

0 comments on commit 9649c42

Please sign in to comment.