Make low level API wrapper in fast, easy.

Overview

PyPI PyPI - Downloads PyPI - License document

lowrapper

The lowrapper is a library for quickly and easily creating an environment for tapping the API without implementation.
Typing the Client class creates a simple API wrapper with type completion.
Also, it may also be useful for creating API wrappers.
Let's start by looking at Simple Example below to see how it works.

Simple Example

This is the weather forecast API's low wrapper.

# 天気予報 API the low level wrapper

from lowrapper import Client, Response

client: Client[Response] = Client("https://weather.tsukumijima.net/api/")

print(client.forecast(method="GET", params={"city": 120010}).json())
# [GET] https://weather.tsukumijima.net/api/forecast?city=120010

This example uses the weather forecast API to get weather forecast information for Chiba Prefecture.
(Chiba Prefecture is a prefecture in Japan.)

Explanation for Simple Example

  1. Pass the API endpoint base URL to Client.
  2. Write the end of the endpoint of the API in the class attribute. (client.forecast -> /forecast)
  3. Hit the API.

As you can see, you can create an endpoint with Python class attributes.
You can also change the arguments for the request. (Let's see FAQs)

Installation

You can install lowrapper by running this command.
pip install lowrapper

If you want asynchronous lowrapper, you can get this by running this command.
pip install lowrapper[asynchronous] or pip install aiohttp

FAQs

Q: I want to hit an endpoint that changes dynamically.
A: You can hit this by using like dictionary as follows.
client[YOUR_DYNAMIC_ENDPOINT]("GET", ...)

Q: I want to type the client class.
A: You can type by inheriting the client class as follows.

Some's PONG! ">
from lowrapper import Client, Path, Response

class Endpoint(Path[Response]):
    ping: Path[Response]

class MySomeAPIClient(Client[Response]):
    some: Endpoint

client = MySomeAPIClient("https://api.some.web/")
print(client.some.ping(method="GET").text)
# [GET] https://api.some.web/some/ping
# -> Some's PONG!

Q: I want to use asynchronous version of lowrapper.
A: You can use it by importing lowrapper.aio as follows.

from lowrapper.aio import Client, Path, CoroutineResponse

client: Client[CoroutineResponse] = Client("https://asynchronous.love/")

And you should install aiohttp to request.

Q: I want to change the request args.
A: You can change the request args like bellow.

Response: return self.__request__(self, method="POST", json={"content": message}) client = MyClient() client.send("Hi") # [POST] https://simple.chat/send # {"content": "Hi"} ">
from lowrapper import Client, Path, Method, Response


class MyClient(Client[Response]):

    BASE = "https://simple.chat/"

    def __init__(self):
        super().__init__(self.BASE)

    def send(self, message: str) -> Response:
        return self.__request__(self, method="POST", json={"content": message})


client = MyClient()
client.send("Hi")
# [POST] https://simple.chat/send
#  {"content": "Hi"}

Q: I want a guide.
A: Let's see documentation's guide.

Contributing

Let's cooperate by making an issue and submitting a Pull Request!
In case of Pull Request, please try not to change the style of the code. (65% PEP8)

Documentation

UserGuide and Documentation is here.

You might also like...
Petpy is an easy-to-use and convenient Python wrapper for the Petfinder API.

Petpy is an easy-to-use and convenient Python wrapper for the Petfinder API. Includes methods for parsing output JSON into pandas DataFrames for easier data analysis

A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python.

disfork A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. Key Features Modern Pythonic API using async a

🚀 A fast, flexible and lightweight Discord API wrapper for Python.
🚀 A fast, flexible and lightweight Discord API wrapper for Python.

Krema A fast, flexible and lightweight Discord API wrapper for Python. Installation Unikorn unikorn add kremayard krema -no-confirmation Pip pip insta

A fast and expressive Craigslist API wrapper

pycraigslist A fast and expressive Craigslist API wrapper. ⚠ As of September 2021, it is believed that Craigslist added a rate-limiter. It is advised

Autodrive is designed to make it as easy as possible to interact with the Google Drive and Sheets APIs via Python

Autodrive Autodrive is designed to make it as easy as possible to interact with the Google Drive and Sheets APIs via Python. It is especially designed

PRAW, an acronym for "Python Reddit API Wrapper", is a python package that allows for simple access to Reddit's API.

PRAW: The Python Reddit API Wrapper PRAW, an acronym for "Python Reddit API Wrapper", is a Python package that allows for simple access to Reddit's AP

Python API wrapper around Trello's API

A wrapper around the Trello API written in Python. Each Trello object is represented by a corresponding Python object. The attributes of these objects

PRAW, an acronym for "Python Reddit API Wrapper", is a python package that allows for simple access to Reddit's API.

PRAW: The Python Reddit API Wrapper PRAW, an acronym for "Python Reddit API Wrapper", is a Python package that allows for simple access to Reddit's AP

An API wrapper around the pythonanywhere's API.

pyaww An API wrapper around the pythonanywhere's API. The name stands for pythonanywherewrapper. 100% api coverage most of the codebase is documented

Comments
  • 全体的な書き直し

    全体的な書き直し

    niconico.pyの辞書をクラスでラップして属性からアクセスできるやつを作る。 ClientBaseを作りhttpxでリクエストできるように実装をしたClientを実装する。 非同期版もClientBaseを継承した同じくhttpxを使用するAioClientを実装する。

    • [ ] 辞書ラッパー
    • [ ] ClientBase
      • [ ] Client
      • [ ] AioClient
    enhancement 
    opened by tasuren 0
Releases(v1.0.2)
Owner
tasuren
Pythonを主にやっている学生です。 Discord:tasuren#5161
tasuren
A simple google translator telegram bot version 2

Translator-Bot-V2 A simple google translator telegram bot version 2 Made with Python3 (C) @FayasNoushad Copyright permission under MIT License License

Fayas Noushad 15 Oct 21, 2022
A simple Discord Mass Dm with Scraper

Python-Mass-DM A simple Discord Mass Dm with Scraper If Member Scraper in Taliban.py doesn't work. You can DM me cuz that scraper is for tokens that g

RyanzSantos 4 Sep 02, 2022
Verkehrsunfälle in Deutschland, aufgeschlüsselt nach Verkehrsmittel des Hauptverursachers und Nebenverursachers

How-To Einfach ./main.py ausführen mit der Statistik-Datei aus dem Ordner "Unfälle_mit_mehreren_Beteiligten" als erstem Argument. Requirements python,

4 Oct 12, 2022
unofficial library for discord components(on development)

discord.py-buttons unofficial library for discord buttons(on development) Install pip install --upgrade discord_buttons Example from discord import Cl

kiki7000 129 Dec 31, 2022
EduuRobot Telegram bot source code.

EduuRobot A multipurpose Telegram Bot made with Pyrogram and asynchronous programming. Requirements Python 3.6+ An Unix-like operating system (Running

Amano Team 119 Dec 23, 2022
Python script to backup/convert your Spotify playlists into the XSPF format.

Python script to backup/convert your Spotify playlists into the XSPF format.

Chris Ovenden 4 Jun 09, 2022
The bot I used to win a 3d printing filament giveaway.

Instagram-CommentBot-For-Giveaways This is the bot I used to win a 3d printer filament giveaway on Instagram. Usually giveaways require you to tag oth

Esad Yusuf Atik 1 Aug 01, 2022
LimitatiBot - A simple telegram bot to establish a conversation with a user without having to use private chats

🤖 LimitatiBot [0.2] LimitatiBot is a simple telegram bot to establish a convers

xMrPente 9 Dec 27, 2022
Pythonic and easy iCalendar library (rfc5545)

ics.py 0.8.0-dev : iCalendar for Humans Original repository (GitHub) - Bugtracker and issues (GitHub) - PyPi package (ics) - Documentation (Read The D

ics.py 513 Jan 02, 2023
Automatically pick a winner who Retweeted, Commented, and Followed your Twitter account!

AutomaticTwitterGiveaways automates selecting winners for "Retweet, Comment, Follow" type Twitter giveaways.

1 Jan 13, 2022
Бот для мини-игры "Рабы" ("Рабство") ВКонтакте.

vk-slaves-bot Бот для мини-игры "Рабы" ("Рабство") ВК Группа в ВК, в ней публикуются новости и другая полезная информация. У группы есть беседа, в кот

Almaz 80 Dec 17, 2022
DDoS Script (DDoS Panel) with Multiple Bypass ( Cloudflare UAM,CAPTCHA,BFM,NOSEC / DDoS Guard / Google Shield / V Shield / Amazon / etc.. )

KARMA DDoS DDoS Script (DDoS Panel) with Multiple Bypass ( Cloudflare UAM,CAPTCHA,BFM,NOSEC / DDoS Guard / Google Shield / V Shield / Amazon / etc.. )

Hyuk 256 Jan 02, 2023
A Pancakeswap and Uniswap trading client (and bot) with limit orders, marker orders, stop-loss, custom gas strategies, a GUI and much more.

Pancakeswap and Uniswap trading client Adam A A Pancakeswap and Uniswap trading client (and bot) with market orders, limit orders, stop-loss, custom g

570 Mar 09, 2022
ShoukoKomiRobot - An anime themed telegram bot that can convert telegram media

ShoukoKomiRobot • 𝕎𝕣𝕚𝕥𝕥𝕖𝕟 𝕀𝕟 Python3 • 𝕃𝕚𝕓𝕣𝕒𝕣𝕪 𝕌𝕤𝕖𝕕 Pyrogram

25 Aug 14, 2022
Discord Bot for SurPath Hub's server

Dayong Dayong is dedicated to helping Discord servers build and manage their communities. Multipurpose —lots of features, lots of automation. Self-hos

SurPath Hub 6 Dec 18, 2021
Mikasa is a 100% Spanish bot, a multifunctional bot, Mikasa is in beta.

Mikasa Miaksa, It is a multi-functional discord bot that is currently in development, this is not complete, there are still many things to fix and imp

Made in 2 Oct 05, 2021
Check and write all account info + Check nitro on account

Discord-Token-Checker Check and write all account info + Check nitro on account Also check https://github.com/GuFFy12/Discord-Token-Parser (Parse disc

36 Jan 01, 2023
ZenML 🙏: MLOps framework to create reproducible ML pipelines for production machine learning.

ZenML is an extensible, open-source MLOps framework to create production-ready machine learning pipelines. It has a simple, flexible syntax, is cloud and tool agnostic, and has interfaces/abstraction

ZenML 2.6k Dec 27, 2022
A collection of tools for managing Jira issues for the RHODS project

RHODS-Jira-Tools A collection of tools for managing Jira issues for the RHODS project move_to_qa.py This script handles transitioning a given Jira iss

Alex Corvin 1 Sep 20, 2022
Automatically Edits Videos and Uploads to Tiktok with 1 line of code.

TiktokAutoUploader - Open to code contributions Automatically Edits Videos and Uploads to Tiktok with 1 line of code. Setup pip install -r requirement

Michael Peres 199 Dec 27, 2022