Init commit; pssecret-server collection
This commit is contained in:
commit
63f74677df
7 changed files with 1221 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
__pycache__/
|
||||
.nvim.lua
|
21
README.md
Normal file
21
README.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
# My requests collections
|
||||
|
||||
Collections of [posting](https://posting.sh/) requests and scripts.
|
||||
|
||||
Collections structure
|
||||
```
|
||||
api-name/
|
||||
├── scripts/
|
||||
│ └── request-name.py
|
||||
└── *.posting.yaml
|
||||
```
|
||||
|
||||
Alternative structure for more complex APIs
|
||||
```
|
||||
api-name/
|
||||
├── scripts/
|
||||
│ └── group-name/
|
||||
│ └── request-name.py
|
||||
└── group-name/
|
||||
└── *.posting.yaml
|
||||
```
|
1159
poetry.lock
generated
Normal file
1159
poetry.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
2
pssecret-server/retrieve-secret.posting.yaml
Normal file
2
pssecret-server/retrieve-secret.posting.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
name: Retrieve secret
|
||||
url: http://localhost:8000/secret/$last_secret_key
|
8
pssecret-server/scripts/store-secret-data.py
Normal file
8
pssecret-server/scripts/store-secret-data.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
import httpx
|
||||
from posting import Posting
|
||||
|
||||
|
||||
def on_response(response: httpx.Response, posting: Posting) -> None:
|
||||
key = response.json()["key"]
|
||||
print(f"Setting '$last_secret_key' to {key}")
|
||||
posting.set_variable("last_secret_key", key)
|
14
pssecret-server/store-secret-data.posting.yaml
Normal file
14
pssecret-server/store-secret-data.posting.yaml
Normal file
|
@ -0,0 +1,14 @@
|
|||
name: Store secret data
|
||||
method: POST
|
||||
url: http://localhost:8000/secret
|
||||
body:
|
||||
content: |-
|
||||
{
|
||||
"data": "my-secret"
|
||||
}
|
||||
content_type: application/json
|
||||
headers:
|
||||
- name: content-type
|
||||
value: application/json
|
||||
scripts:
|
||||
on_response: scripts/store-secret-data.py
|
15
pyproject.toml
Normal file
15
pyproject.toml
Normal file
|
@ -0,0 +1,15 @@
|
|||
[tool.poetry]
|
||||
package-mode = false
|
||||
description = "My posting requests collections"
|
||||
authors = ["Ivan Golikov <root@ivnglkv.me>"]
|
||||
license = "MIT"
|
||||
readme = "README.md"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.12"
|
||||
posting = "*"
|
||||
|
||||
[tool.basedpyright]
|
||||
reportAny = false
|
||||
reportMissingTypeStubs = false
|
||||
reportUnusedCallResult = false
|
Loading…
Reference in a new issue