Skip to content

ararog/paya

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

paya

A minimum rest client based on deboa http client for rust

Installation

pip install paya

Usage

import asyncio
import json
import paya
from paya import send


async def main():
    req = paya.Paya("https://jsonplaceholder.typicode.com").get("/todos/1")
    res = await send(req)
    data = json.loads(res.body())
    print(data)

    req = (
        req.post("/posts")
        .header("Content-Type", "application/json")
        .body(
            json.dumps(
                {"title": "Some title", "body": "Some body", "userId": 1}
            ).encode("utf-8")
        )
    )
    res = await send(req)
    data = json.loads(res.body())
    print(data)

    req = req.delete("/posts/1")
    res = await send(req)
    data = json.loads(res.body())
    print(data)

asyncio.run(main())

License

MIT

Author

Rogerio Pereira Araujo rogerio.araujo@gmail.com

About

A rest api client powered by rust deboa http client.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •