{"repo":"reagento/descanso","free":true,"listed":false,"github":"https://github.com/reagento/descanso","clone":"git clone https://github.com/reagento/descanso.git","description":"A modern and simple way to create clients for REST like APIs","language":"Python","stars":141,"topics":["rest","rest-api","python","dataclasses","code-generation"],"license":"Apache-2.0","category":"api-integrations-sdks","readme_excerpt":"Descanso A modern and simple way to create clients for REST like APIs If you are looking for dataclass-rest , this is the same project with a new name. We had reworked it a lot, but old code is still available in a separate branch. Quickstart Step 1. Install requests and adaptix are optional dependencies, but we will use them in quickstart. Step 2. Declare models Step 3. Select serialization library. We recommend using adaptix . You need to have Loader and Dumper implementations, adaptix.Retort would be fine Step 4. Configure RestBuilder instance. It is needed to reuse common step during request. Step 5. Create client class. Use RequestsClient or AiohttpClient Step 6. Declare methods using rest.get / rest.post / rest.delete / rest.patch / rest.put decorators. You can override RestBuilder params if needed. Type hints are required. Body of method is ignored. Use any method arguments to format URL. body argument is sent as request body with json. Other arguments, not used in the URL are passed as query parameters. Step 7. Create client instance and use it. Asyncio To use async client instead of sync: 1. Install aiohttp (instead of requests ) 2. Change descanso.http.requests.RequestsClient to descanso.http.aiohttp.AiohttpClient 3. All methods will be async, but you can add async keyword to make it more verbose","default_branch":null,"files":null,"tree":[],"storefront":"/r/reagento","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/reagento/descanso/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}