Init commit; pssecret-server collection

This commit is contained in:
Ivan Golikov 2025-01-06 17:13:59 +01:00
commit 63f74677df
7 changed files with 1221 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
__pycache__/
.nvim.lua

21
README.md Normal file
View 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

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,2 @@
name: Retrieve secret
url: http://localhost:8000/secret/$last_secret_key

View 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)

View 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
View 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