-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from Riminder/feat/asking-unfolding-apis
feat: asking, authentication, and unfolding APIs; and test suite
- Loading branch information
Showing
53 changed files
with
3,496 additions
and
474 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
HRFLOW_API_KEY="___FILL_ME___" | ||
HRFLOW_USER_EMAIL="___FILL_ME___" | ||
HRFLOW_API_KEY_READ="___FILL_ME___" | ||
HRFLOW_USER_EMAIL="___FILL_ME___" | ||
HRFLOW_ALGORITHM_KEY="___FILL_ME___" | ||
HRFLOW_BOARD_KEY="___FILL_ME___" | ||
HRFLOW_JOB_KEY="___JOB_KEY_IN_BOARD___" | ||
HRFLOW_PROFILE_KEY="___PROFILE_KEY_IN_SOURCE_QUICKSILVER_SYNC___" | ||
HRFLOW_SOURCE_KEY_HAWK_SYNC="___FILL_ME___" | ||
HRFLOW_SOURCE_KEY_QUICKSILVER_SYNC="___FILL_ME___" | ||
HRFLOW_SOURCE_KEY_QUICKSILVER_ASYNC="___FILL_ME___" | ||
HRFLOW_SOURCE_KEY_MOZART_ASYNC="___FILL_ME___" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[flake8] | ||
max-line-length = 88 | ||
exclude = .pytest_cache, __pycache__, .env, .venv | ||
black-config = pyproject.toml | ||
per-file-ignores = __init__.py:F401 | ||
ignore = E731, W503, E203 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ credentials | |
credentials_seg | ||
test/* | ||
test_assets/* | ||
tests/assets | ||
.htpasswd | ||
|
||
docker/dependencies/libs/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
PYTEST_RUN="poetry run pytest" | ||
PYTEST_OPTIONS=(--verbose --tb=long --strict-markers --durations=0 --datefmt "%Y-%m-%d %H:%M:%S.%f%z") | ||
PYTEST_DIR=tests/ | ||
|
||
if [ "$#" -gt 0 ]; then | ||
for marker in "$@"; do | ||
$PYTEST_RUN "${PYTEST_OPTIONS[@]}" "$PYTEST_DIR" -m "$marker" | ||
done | ||
else | ||
$PYTEST_RUN "${PYTEST_OPTIONS[@]}" "$PYTEST_DIR" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
from .__version__ import ( | ||
__author__, | ||
__author_email__, | ||
__description__, | ||
__license__, | ||
__title__, | ||
__url__, | ||
__version__, | ||
) | ||
from .hrflow.hrflow import Hrflow | ||
|
||
from .__version__ import __title__, __description__, __url__, __version__ | ||
from .__version__ import __author__, __author_email__, __license__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import typing as t | ||
|
||
from ..utils import validate_key, validate_response | ||
|
||
API_SECRET_REGEX = r"^ask[rw]?_[0-9a-f]{32}$" | ||
|
||
|
||
class Auth: | ||
def __init__(self, api): | ||
self.client = api | ||
|
||
def get(self) -> t.Dict[str, t.Any]: | ||
""" | ||
Try your API Keys. This endpoint allows you to learn how to add the right | ||
information to your API calls, so you can make them. | ||
Args: | ||
api_user: <str> | ||
Your HrFlow.ai account's email. | ||
api_secret: <str> | ||
Your API Key. | ||
Returns: | ||
`/auth` response | ||
""" | ||
|
||
validate_key( | ||
"api_secret", | ||
self.client.auth_header.get("X-API-KEY"), | ||
regex=API_SECRET_REGEX, | ||
) | ||
|
||
response = self.client.get("auth") | ||
|
||
return validate_response(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.