hyperpocket 0.3.2__tar.gz → 0.3.4__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/PKG-INFO +1 -1
- hyperpocket-0.3.4/hyperpocket/auth/apitoken/README.md +28 -0
- hyperpocket-0.3.4/hyperpocket/auth/apitoken/context.py +15 -0
- hyperpocket-0.3.4/hyperpocket/auth/apitoken/token_context.py +12 -0
- hyperpocket-0.3.4/hyperpocket/auth/apitoken/token_handler.py +89 -0
- hyperpocket-0.3.4/hyperpocket/auth/apitoken/token_schema.py +9 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/provider.py +2 -0
- hyperpocket-0.3.4/hyperpocket/auth/serpapi/context.py +15 -0
- hyperpocket-0.3.4/hyperpocket/auth/serpapi/token_context.py +13 -0
- hyperpocket-0.3.4/hyperpocket/auth/serpapi/token_handler.py +68 -0
- hyperpocket-0.3.4/hyperpocket/auth/serpapi/token_schema.py +11 -0
- hyperpocket-0.3.4/hyperpocket/server/auth/apitoken.py +16 -0
- hyperpocket-0.3.4/hyperpocket/server/auth/serpapi.py +14 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/pyproject.toml +1 -1
- hyperpocket-0.3.4/tests/session/__init__.py +0 -0
- hyperpocket-0.3.4/tests/tool/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/.gitignore +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/README.md +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/README.md +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/__init__.py +0 -0
- {hyperpocket-0.3.2/hyperpocket/auth/calendly → hyperpocket-0.3.4/hyperpocket/auth/apitoken}/__init__.py +0 -0
- {hyperpocket-0.3.2/hyperpocket/auth/github → hyperpocket-0.3.4/hyperpocket/auth/calendly}/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/calendly/context.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/calendly/oauth2_context.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/calendly/oauth2_handler.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/calendly/oauth2_schema.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/context.py +0 -0
- {hyperpocket-0.3.2/hyperpocket/auth/google → hyperpocket-0.3.4/hyperpocket/auth/github}/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/github/context.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/github/oauth2_context.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/github/oauth2_handler.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/github/oauth2_schema.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/github/token_context.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/github/token_handler.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/github/token_schema.py +0 -0
- {hyperpocket-0.3.2/hyperpocket/auth/gumloop → hyperpocket-0.3.4/hyperpocket/auth/google}/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/google/context.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/google/oauth2_context.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/google/oauth2_handler.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/google/oauth2_schema.py +0 -0
- {hyperpocket-0.3.2/hyperpocket/auth/linear → hyperpocket-0.3.4/hyperpocket/auth/gumloop}/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/gumloop/context.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/gumloop/token_context.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/gumloop/token_handler.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/gumloop/token_schema.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/handler.py +0 -0
- {hyperpocket-0.3.2/hyperpocket/auth/notion → hyperpocket-0.3.4/hyperpocket/auth/linear}/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/linear/context.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/linear/token_context.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/linear/token_handler.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/linear/token_schema.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/notion/README.md +0 -0
- {hyperpocket-0.3.2/hyperpocket/auth/reddit → hyperpocket-0.3.4/hyperpocket/auth/notion}/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/notion/context.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/notion/token_context.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/notion/token_handler.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/notion/token_schema.py +0 -0
- {hyperpocket-0.3.2/hyperpocket/auth/slack → hyperpocket-0.3.4/hyperpocket/auth/reddit}/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/reddit/context.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/reddit/oauth2_context.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/reddit/oauth2_handler.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/reddit/oauth2_schema.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/schema.py +0 -0
- {hyperpocket-0.3.2/hyperpocket/auth/x → hyperpocket-0.3.4/hyperpocket/auth/serpapi}/__init__.py +0 -0
- {hyperpocket-0.3.2/hyperpocket/cli → hyperpocket-0.3.4/hyperpocket/auth/slack}/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/slack/context.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/slack/oauth2_context.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/slack/oauth2_handler.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/slack/oauth2_schema.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/slack/token_context.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/slack/token_handler.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/slack/token_schema.py +0 -0
- {hyperpocket-0.3.2/hyperpocket/cli/codegen → hyperpocket-0.3.4/hyperpocket/auth/x}/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/x/context.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/x/oauth2_context.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/x/oauth2_handler.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/auth/x/oauth2_schema.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/builtin.py +0 -0
- {hyperpocket-0.3.2/hyperpocket/server/tool/dto → hyperpocket-0.3.4/hyperpocket/cli}/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/__main__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/auth_oauth2.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/auth_token.py +0 -0
- {hyperpocket-0.3.2/hyperpocket/tool/tests → hyperpocket-0.3.4/hyperpocket/cli/codegen}/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/codegen/auth/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/codegen/auth/auth_context_template.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/codegen/auth/auth_oauth2_context_template.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/codegen/auth/auth_oauth2_handler_template.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/codegen/auth/auth_oauth2_schema_template.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/codegen/auth/auth_token_context_template.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/codegen/auth/auth_token_handler_template.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/codegen/auth/auth_token_schema_template.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/codegen/auth/server_auth_template.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/codegen/tool/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/codegen/tool/tool_main_template.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/eject.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/pull.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/sync.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/tool.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/config/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/config/auth.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/config/git.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/config/logger.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/config/session.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/config/settings.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/constants.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/futures/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/futures/futurestore.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/pocket_auth.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/pocket_core.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/pocket_main.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/prompts.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/repository/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/repository/lock.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/repository/lockfile.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/repository/repository.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/server/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/server/auth/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/server/auth/calendly.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/server/auth/github.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/server/auth/google.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/server/auth/gumloop.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/server/auth/linear.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/server/auth/notion.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/server/auth/reddit.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/server/auth/slack.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/server/auth/token.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/server/auth/x.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/server/proxy.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/server/server.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/server/tool/__init__.py +0 -0
- {hyperpocket-0.3.2/tests → hyperpocket-0.3.4/hyperpocket/server/tool/dto}/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/server/tool/dto/script.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/server/tool/wasm.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/session/README.md +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/session/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/session/in_memory.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/session/interface.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/session/redis.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/tool/README.md +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/tool/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/tool/function/README.md +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/tool/function/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/tool/function/annotation.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/tool/function/tool.py +0 -0
- {hyperpocket-0.3.2/tests/auth → hyperpocket-0.3.4/hyperpocket/tool/tests}/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/tool/tool.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/tool/wasm/README.md +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/tool/wasm/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/tool/wasm/browser.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/tool/wasm/invoker.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/tool/wasm/script.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/tool/wasm/templates/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/tool/wasm/templates/node.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/tool/wasm/templates/python.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/tool/wasm/tool.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/tool_like.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/util/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/util/extract_func_param_desc_from_docstring.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/util/find_all_leaf_class_in_package.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/util/find_all_subclass_in_package.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/util/flatten_json_schema.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/util/function_to_model.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/util/get_objects_from_subpackage.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/util/json_schema_to_model.py +0 -0
- {hyperpocket-0.3.2/tests/session → hyperpocket-0.3.4/tests}/__init__.py +0 -0
- {hyperpocket-0.3.2/tests/tool → hyperpocket-0.3.4/tests/auth}/__init__.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/tests/auth/test_google_oauth2_handler.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/tests/auth/test_gumloop_token_handler.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/tests/auth/test_notion_token_handler.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/tests/auth/test_slack_oauth2_handler.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/tests/auth/test_slack_token_handler.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/tests/session/test_in_memory.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/tests/session/test_redis.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/tests/test_pocket.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/tests/test_pocket_auth.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/tests/test_pocket_core.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/tests/tool/test_function_tool.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/tests/tool/test_wasm_tool.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/tests/utils/test_extract_func_param_desc_from_docstring.py +0 -0
- {hyperpocket-0.3.2 → hyperpocket-0.3.4}/uv.lock +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: hyperpocket
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.4
|
4
4
|
Summary: Building AI agent with hyperpocket tool in a flash
|
5
5
|
Project-URL: Homepage, https://vessl-ai.github.io/hyperpocket
|
6
6
|
Project-URL: Repository, https://github.com/vessl-ai/hyperpocket
|
@@ -0,0 +1,28 @@
|
|
1
|
+
### API Token Auth
|
2
|
+
|
3
|
+
This module provides authentication using simple API tokens.
|
4
|
+
|
5
|
+
1. To use this authentication in your tool, include the following in your `config.toml`:
|
6
|
+
|
7
|
+
```toml
|
8
|
+
[auth]
|
9
|
+
auth_provider = "apitoken"
|
10
|
+
auth_handler = "apitoken"
|
11
|
+
scopes = []
|
12
|
+
```
|
13
|
+
|
14
|
+
2. To use it with `function_tool`, you can define your function as follows:
|
15
|
+
|
16
|
+
```python
|
17
|
+
from hyperpocket.tool import function_tool
|
18
|
+
from hyperpocket.auth import AuthProvider
|
19
|
+
|
20
|
+
|
21
|
+
@function_tool(
|
22
|
+
auth_provider=AuthProvider.API_TOKEN
|
23
|
+
)
|
24
|
+
def my_function(**kwargs):
|
25
|
+
token = kwargs["API_TOKEN"]
|
26
|
+
|
27
|
+
# ...
|
28
|
+
```
|
@@ -0,0 +1,15 @@
|
|
1
|
+
from hyperpocket.auth.context import AuthContext
|
2
|
+
|
3
|
+
|
4
|
+
class ApiTokenAuthContext(AuthContext):
|
5
|
+
_ACCESS_TOKEN_KEY: str = "API_TOKEN"
|
6
|
+
|
7
|
+
def to_dict(self) -> dict[str, str]:
|
8
|
+
return {
|
9
|
+
self._ACCESS_TOKEN_KEY: self.access_token,
|
10
|
+
}
|
11
|
+
|
12
|
+
def to_profiled_dict(self, profile: str) -> dict[str, str]:
|
13
|
+
return {
|
14
|
+
f"{profile.upper()}_{self._ACCESS_TOKEN_KEY}": self.access_token,
|
15
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
from hyperpocket.auth.apitoken.context import ApiTokenAuthContext
|
2
|
+
from hyperpocket.auth.apitoken.token_schema import ApiTokenResponse
|
3
|
+
|
4
|
+
|
5
|
+
class ApiTokenAuthContext(ApiTokenAuthContext):
|
6
|
+
@classmethod
|
7
|
+
def from_api_token_response(cls, response: ApiTokenResponse):
|
8
|
+
description = "Api Token Context logged in"
|
9
|
+
|
10
|
+
return cls(
|
11
|
+
access_token=response.access_token, description=description, expires_at=None
|
12
|
+
)
|
@@ -0,0 +1,89 @@
|
|
1
|
+
from typing import Optional
|
2
|
+
from urllib.parse import urlencode, urljoin
|
3
|
+
|
4
|
+
from hyperpocket.auth import AuthProvider
|
5
|
+
from hyperpocket.auth.context import AuthContext
|
6
|
+
from hyperpocket.auth.handler import AuthHandlerInterface
|
7
|
+
from hyperpocket.auth.apitoken.token_context import ApiTokenAuthContext
|
8
|
+
from hyperpocket.auth.apitoken.token_schema import ApiTokenRequest, ApiTokenResponse
|
9
|
+
from hyperpocket.config import config
|
10
|
+
from hyperpocket.futures import FutureStore
|
11
|
+
|
12
|
+
|
13
|
+
class ApiTokenAuthHandler(AuthHandlerInterface):
|
14
|
+
name: str = "apitoken"
|
15
|
+
description: str = "This handler is used to authenticate users using the Api token."
|
16
|
+
scoped: bool = False
|
17
|
+
|
18
|
+
_TOKEN_URL: str = urljoin(
|
19
|
+
config().public_base_url + "/",
|
20
|
+
f"{config().callback_url_rewrite_prefix}/auth/token",
|
21
|
+
)
|
22
|
+
|
23
|
+
@staticmethod
|
24
|
+
def provider() -> AuthProvider:
|
25
|
+
return AuthProvider.APITOKEN
|
26
|
+
|
27
|
+
@staticmethod
|
28
|
+
def recommended_scopes() -> set[str]:
|
29
|
+
return set()
|
30
|
+
|
31
|
+
@staticmethod
|
32
|
+
def provider_default() -> bool:
|
33
|
+
return True
|
34
|
+
|
35
|
+
def prepare(
|
36
|
+
self,
|
37
|
+
auth_req: ApiTokenRequest,
|
38
|
+
thread_id: str,
|
39
|
+
profile: str,
|
40
|
+
future_uid: str,
|
41
|
+
*args,
|
42
|
+
**kwargs,
|
43
|
+
) -> str:
|
44
|
+
redirect_uri = urljoin(
|
45
|
+
config().public_base_url + "/",
|
46
|
+
f"{config().callback_url_rewrite_prefix}/auth/apitoken/token/callback",
|
47
|
+
)
|
48
|
+
url = self._make_auth_url(
|
49
|
+
auth_req=auth_req, redirect_uri=redirect_uri, state=future_uid
|
50
|
+
)
|
51
|
+
FutureStore.create_future(
|
52
|
+
future_uid,
|
53
|
+
data={
|
54
|
+
"redirect_uri": redirect_uri,
|
55
|
+
"thread_id": thread_id,
|
56
|
+
"profile": profile,
|
57
|
+
},
|
58
|
+
)
|
59
|
+
|
60
|
+
return f"User needs to authenticate using the following URL: {url}"
|
61
|
+
|
62
|
+
async def authenticate(
|
63
|
+
self, auth_req: ApiTokenRequest, future_uid: str, *args, **kwargs
|
64
|
+
) -> AuthContext:
|
65
|
+
future_data = FutureStore.get_future(future_uid)
|
66
|
+
access_token = await future_data.future
|
67
|
+
|
68
|
+
response = ApiTokenResponse(access_token=access_token)
|
69
|
+
context = ApiTokenAuthContext.from_api_token_response(response)
|
70
|
+
|
71
|
+
return context
|
72
|
+
|
73
|
+
async def refresh(
|
74
|
+
self, auth_req: ApiTokenRequest, context: AuthContext, *args, **kwargs
|
75
|
+
) -> AuthContext:
|
76
|
+
raise Exception("Api token doesn't support refresh")
|
77
|
+
|
78
|
+
def _make_auth_url(self, auth_req: ApiTokenRequest, redirect_uri: str, state: str):
|
79
|
+
params = {
|
80
|
+
"redirect_uri": redirect_uri,
|
81
|
+
"state": state,
|
82
|
+
}
|
83
|
+
auth_url = f"{self._TOKEN_URL}?{urlencode(params)}"
|
84
|
+
return auth_url
|
85
|
+
|
86
|
+
def make_request(
|
87
|
+
self, auth_scopes: Optional[list[str]] = None, **kwargs
|
88
|
+
) -> ApiTokenRequest:
|
89
|
+
return ApiTokenRequest()
|
@@ -0,0 +1,15 @@
|
|
1
|
+
from hyperpocket.auth.context import AuthContext
|
2
|
+
|
3
|
+
|
4
|
+
class SerpapiAuthContext(AuthContext):
|
5
|
+
_ACCESS_TOKEN_KEY: str = "SERPAPI_TOKEN"
|
6
|
+
|
7
|
+
def to_dict(self) -> dict[str, str]:
|
8
|
+
return {
|
9
|
+
self._ACCESS_TOKEN_KEY: self.access_token,
|
10
|
+
}
|
11
|
+
|
12
|
+
def to_profiled_dict(self, profile: str) -> dict[str, str]:
|
13
|
+
return {
|
14
|
+
f"{profile.upper()}_{self._ACCESS_TOKEN_KEY}": self.access_token,
|
15
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from hyperpocket.auth.serpapi.context import SerpapiAuthContext
|
2
|
+
from hyperpocket.auth.serpapi.token_schema import SerpapiTokenResponse
|
3
|
+
|
4
|
+
|
5
|
+
class SerpapiTokenAuthContext(SerpapiAuthContext):
|
6
|
+
@classmethod
|
7
|
+
def from_serpapi_token_response(cls, response: SerpapiTokenResponse):
|
8
|
+
description = f'Serpapi Token Context logged in'
|
9
|
+
return cls(
|
10
|
+
access_token=response.access_token,
|
11
|
+
description=description,
|
12
|
+
expires_at=None
|
13
|
+
)
|
@@ -0,0 +1,68 @@
|
|
1
|
+
from typing import Optional
|
2
|
+
from urllib.parse import urljoin, urlencode
|
3
|
+
|
4
|
+
from hyperpocket.auth import AuthProvider
|
5
|
+
from hyperpocket.auth.context import AuthContext
|
6
|
+
from hyperpocket.auth.handler import AuthHandlerInterface, AuthenticateRequest
|
7
|
+
from hyperpocket.auth.serpapi.token_context import SerpapiTokenAuthContext
|
8
|
+
from hyperpocket.auth.serpapi.token_schema import SerpapiTokenResponse, SerpapiTokenRequest
|
9
|
+
from hyperpocket.config import config
|
10
|
+
from hyperpocket.futures import FutureStore
|
11
|
+
|
12
|
+
|
13
|
+
class SerpapiTokenAuthHandler(AuthHandlerInterface):
|
14
|
+
name: str = "serpapi-token"
|
15
|
+
description: str = "This handler is used to authenticate users using the Serpapi token."
|
16
|
+
scoped: bool = False
|
17
|
+
|
18
|
+
_TOKEN_URL: str = urljoin(config().public_base_url + "/", f"{config().callback_url_rewrite_prefix}/auth/token")
|
19
|
+
|
20
|
+
@staticmethod
|
21
|
+
def provider_default() -> bool:
|
22
|
+
return True
|
23
|
+
|
24
|
+
@staticmethod
|
25
|
+
def provider() -> AuthProvider:
|
26
|
+
return AuthProvider.SERPAPI
|
27
|
+
|
28
|
+
@staticmethod
|
29
|
+
def recommended_scopes() -> set[str]:
|
30
|
+
return set()
|
31
|
+
|
32
|
+
def prepare(self, auth_req: SerpapiTokenRequest, thread_id: str, profile: str,
|
33
|
+
future_uid: str, *args, **kwargs) -> str:
|
34
|
+
redirect_uri = urljoin(
|
35
|
+
config().public_base_url + "/",
|
36
|
+
f"{config().callback_url_rewrite_prefix}/auth/serpapi/token/callback",
|
37
|
+
)
|
38
|
+
url = self._make_auth_url(auth_req=auth_req, redirect_uri=redirect_uri, state=future_uid)
|
39
|
+
FutureStore.create_future(future_uid, data={
|
40
|
+
"redirect_uri": redirect_uri,
|
41
|
+
"thread_id": thread_id,
|
42
|
+
"profile": profile,
|
43
|
+
})
|
44
|
+
|
45
|
+
return f'User needs to authenticate using the following URL: {url}'
|
46
|
+
|
47
|
+
async def authenticate(self, auth_req: SerpapiTokenRequest, future_uid: str, *args, **kwargs) -> AuthContext:
|
48
|
+
future_data = FutureStore.get_future(future_uid)
|
49
|
+
access_token = await future_data.future
|
50
|
+
|
51
|
+
response = SerpapiTokenResponse(access_token=access_token)
|
52
|
+
context = SerpapiTokenAuthContext.from_serpapi_token_response(response)
|
53
|
+
|
54
|
+
return context
|
55
|
+
|
56
|
+
async def refresh(self, auth_req: SerpapiTokenRequest, context: AuthContext, *args, **kwargs) -> AuthContext:
|
57
|
+
raise Exception("Serpapi token doesn't support refresh")
|
58
|
+
|
59
|
+
def _make_auth_url(self, auth_req: SerpapiTokenRequest, redirect_uri: str, state: str):
|
60
|
+
params = {
|
61
|
+
"redirect_uri": redirect_uri,
|
62
|
+
"state": state,
|
63
|
+
}
|
64
|
+
auth_url = f"{self._TOKEN_URL}?{urlencode(params)}"
|
65
|
+
return auth_url
|
66
|
+
|
67
|
+
def make_request(self, auth_scopes: Optional[list[str]] = None, **kwargs) -> SerpapiTokenRequest:
|
68
|
+
return SerpapiTokenRequest()
|
@@ -0,0 +1,11 @@
|
|
1
|
+
from typing import List, Optional
|
2
|
+
from pydantic import BaseModel
|
3
|
+
from hyperpocket.auth.schema import AuthenticateRequest, AuthenticateResponse
|
4
|
+
|
5
|
+
|
6
|
+
class SerpapiTokenRequest(AuthenticateRequest):
|
7
|
+
pass
|
8
|
+
|
9
|
+
|
10
|
+
class SerpapiTokenResponse(AuthenticateResponse):
|
11
|
+
access_token: str
|
@@ -0,0 +1,16 @@
|
|
1
|
+
from fastapi import APIRouter
|
2
|
+
from starlette.responses import HTMLResponse
|
3
|
+
|
4
|
+
from hyperpocket.futures import FutureStore
|
5
|
+
|
6
|
+
api_token_auth_router = APIRouter(prefix="/apitoken")
|
7
|
+
|
8
|
+
|
9
|
+
@api_token_auth_router.get("/token/callback")
|
10
|
+
async def notion_token_callback(state: str, token: str):
|
11
|
+
try:
|
12
|
+
FutureStore.resolve_future(state, token)
|
13
|
+
except ValueError:
|
14
|
+
return HTMLResponse(content="failed")
|
15
|
+
|
16
|
+
return HTMLResponse(content="success")
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
from fastapi import APIRouter
|
3
|
+
from starlette.responses import HTMLResponse
|
4
|
+
from hyperpocket.futures import FutureStore
|
5
|
+
serpapi_auth_router = APIRouter(
|
6
|
+
prefix="/serpapi"
|
7
|
+
)
|
8
|
+
@serpapi_auth_router.get("/token/callback")
|
9
|
+
async def serpapi_token_callback(state: str, token: str):
|
10
|
+
try:
|
11
|
+
FutureStore.resolve_future(state, token)
|
12
|
+
except ValueError:
|
13
|
+
return HTMLResponse(content="failed")
|
14
|
+
return HTMLResponse(content="success")
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{hyperpocket-0.3.2/hyperpocket/auth/google → hyperpocket-0.3.4/hyperpocket/auth/github}/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{hyperpocket-0.3.2/hyperpocket/auth/gumloop → hyperpocket-0.3.4/hyperpocket/auth/google}/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{hyperpocket-0.3.2/hyperpocket/auth/linear → hyperpocket-0.3.4/hyperpocket/auth/gumloop}/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{hyperpocket-0.3.2/hyperpocket/auth/notion → hyperpocket-0.3.4/hyperpocket/auth/linear}/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{hyperpocket-0.3.2/hyperpocket/auth/reddit → hyperpocket-0.3.4/hyperpocket/auth/notion}/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{hyperpocket-0.3.2/hyperpocket/auth/slack → hyperpocket-0.3.4/hyperpocket/auth/reddit}/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{hyperpocket-0.3.2/hyperpocket/auth/x → hyperpocket-0.3.4/hyperpocket/auth/serpapi}/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{hyperpocket-0.3.2/hyperpocket/cli/codegen → hyperpocket-0.3.4/hyperpocket/auth/x}/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{hyperpocket-0.3.2/hyperpocket/server/tool/dto → hyperpocket-0.3.4/hyperpocket/cli}/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{hyperpocket-0.3.2/hyperpocket/tool/tests → hyperpocket-0.3.4/hyperpocket/cli/codegen}/__init__.py
RENAMED
File without changes
|
File without changes
|
{hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/codegen/auth/auth_context_template.py
RENAMED
File without changes
|
{hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/codegen/auth/auth_oauth2_context_template.py
RENAMED
File without changes
|
{hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/codegen/auth/auth_oauth2_handler_template.py
RENAMED
File without changes
|
{hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/codegen/auth/auth_oauth2_schema_template.py
RENAMED
File without changes
|
{hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/codegen/auth/auth_token_context_template.py
RENAMED
File without changes
|
{hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/codegen/auth/auth_token_handler_template.py
RENAMED
File without changes
|
{hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/codegen/auth/auth_token_schema_template.py
RENAMED
File without changes
|
{hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/cli/codegen/auth/server_auth_template.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{hyperpocket-0.3.2 → hyperpocket-0.3.4}/hyperpocket/util/extract_func_param_desc_from_docstring.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{hyperpocket-0.3.2 → hyperpocket-0.3.4}/tests/utils/test_extract_func_param_desc_from_docstring.py
RENAMED
File without changes
|
File without changes
|