python client for yemot api module and yemot rest api
Project description
from typing import Annotated, Literal
from fastapi import Depends, FastAPI, HTTPException, Request, responses
from yemot_api.api_model import ApiModel
from yemot_api.api_response import id_list_message_text, join, routing_yemot
from yemot_api.input_types import FileAction
from yemot_api.yemot_api import Yemot
def verify_yemot(request: Request) -> Literal[True]:
user_agent = request.headers.get("user-agent")
if user_agent != "yemot-core-api/1.0":
raise HTTPException(status_code=403, detail=f"Access denied: {user_agent}")
return True
class ApiModelExample(ApiModel):
path: str
token: str
# app = FastAPI(dependencies=[Depends(verify_yemot)])
app = FastAPI()
@app.get("/foo")
def foo(q: Annotated[ApiModelExample, Depends()]) -> responses.PlainTextResponse:
yemot_ins = Yemot(q.token)
if not yemot_ins.check_if_file_exists(q.path):
return responses.PlainTextResponse("ERROR", 404)
content = yemot_ins.download_file(q.path)
with open("testtt.wav", "wb") as f:
f.write(content)
yemot_ins.file_action(FileAction.MOVE, q.path, "1")
res_1 = id_list_message_text("הנך מועבר למערכת אחרת")
res_2 = routing_yemot("0773137770")
res = join(res_1, res_2)
return responses.PlainTextResponse(res, 200)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
yemot_api-0.1.21.tar.gz
(66.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yemot_api-0.1.21.tar.gz.
File metadata
- Download URL: yemot_api-0.1.21.tar.gz
- Upload date:
- Size: 66.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac197004f2eb54787eaa10f75e2a6dfd98f47b6df3464a54ebb922d46f060818
|
|
| MD5 |
29c32115a81c0b7d14741307f48540e8
|
|
| BLAKE2b-256 |
02241ad59c95053e00f94a4c8f96224492b5efa5679a2b66a277a1446f66d813
|
File details
Details for the file yemot_api-0.1.21-py3-none-any.whl.
File metadata
- Download URL: yemot_api-0.1.21-py3-none-any.whl
- Upload date:
- Size: 50.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b21e4f91a5d63a970bdc74868efe7585194696b0cc9432b65000f086ed23c5b1
|
|
| MD5 |
71221ce2ac83d544cc27674d094e5b92
|
|
| BLAKE2b-256 |
e6663940702b0fa7a4e70d63a16e430936904c651c7f82138aafb7422f700cae
|