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
An all-purpose Discord bot written in Python featuring a diverse collection of practical utilities.

GlazeGlopBot Table of Contents About Setup Usage Commands Command Errors Cog Management Local Sound Files Cogs Mod QR RNG VC Weather Proposed Features

Edison Ye 0 May 12, 2022
An EmbedBuilder in Python for discord.py embeds. Pip Module.

Discord.py-MaxEmbeds An EmbedBuilder for Discord bots in Python. You need discord.py to use this module. Installation Step 1 First you have to install

Max Tischberger 6 Jan 13, 2022
Open Resource Calculator Module for Python

Calculator Module for Python By White Night Install #

White_Night_awa 4 Aug 22, 2022
Discord bot for playing blindfold chess.

Albin Discord bot for playing blindfold chess written in Python. Albin takes the moves from chat and pushes them on the board without showing it. TODO

8 Oct 14, 2022
A minimal caching proxy to GitHub's REST & GraphQL APIs

github-proxy A caching forward proxy to GitHub's REST and GraphQL APIs. GitHub-Proxy is a thin, highly extensible, highly configurable python framewor

Babylon Health 26 Oct 05, 2022
A telegram photos or videos background remover bot

Remove BG Bot A telegram photos or videos background remover bot Variables API_HASH Your API Hash from my.telegram.org API_ID Your API ID from my.tele

ALBY 7 Dec 13, 2022
A Python wrapper around the Twitter API.

Python Twitter A Python wrapper around the Twitter API. By the Python-Twitter Developers Introduction This library provides a pure Python interface fo

Mike Taylor 3.4k Jan 01, 2023
Framework to collect and process weather data from wttr.in.

Weathercrawler Automatic extraction and processing framework for weather data from wttr.in Installation tested with: Python 3.7.3 Python 3.9.4 git clo

Maurice Günder 0 Jul 26, 2021
Manage gmail account using python, forget about imap and just code what you supposed to do.

GGmail Manage gmail account using python, forget about imap and just code what you supposed to do. Help See documentation for more details. Install In

Dylan Do Amaral 6 Sep 23, 2022
Discord bot ( discord.py ), uses pandas library from python for data-management.

Discord_bot A Best and the most easy-to-use Discord bot !! Some simple basic auto moderations, Chat functions. It includes a game similar to Casino, g

Jaitej 4 Aug 30, 2022
Huan Xu 1.6k Jan 04, 2023
Pure Python 3 MTProto API Telegram client library, for bots too!

Telethon ⭐️ Thanks everyone who has starred the project, it means a lot! Telethon is an asyncio Python 3 MTProto library to interact with Telegram's A

LonamiWebs 7.3k Jan 01, 2023
OpenSea-Python-Bot - OpenSea Python Bot can be used in 2 modes

OpenSea-Python-Bot OpenSea Python Bot can be used in 2 modes. When --nft paramet

49 Feb 10, 2022
A Pancakeswap v2 trading client (and bot) with limit orders, stop-loss, custom gas strategies, a GUI and much more.

Pancakeswap v2 trading client A Pancakeswap trading client (and bot) with limit orders, stop-loss, custom gas strategies, a GUI and much more. If you

571 Mar 15, 2022
A beginner’s guide to train and deploy machine learning pipelines in Python using PyCaret

This model involves Insurance bill prediction, which was subsequently deployed on Heroku PaaS

1 Jan 27, 2022
🤖 Automated follow/unfollow bot for GitHub. Uses GitHub API. Written in python.

GitHub Follow Bot Table of Contents Disclaimer How to Use Install requirements Authenticate Get a GitHub Personal Access Token Add your GitHub usernam

João Correia 37 Dec 27, 2022
A Python SDK for Tinybird 🐦

Verdin Verdin is a tiny bird, and also a Python SDK for Tinybird . Install pip install verdin Usage Query a Pipe # the tinybird module exposes all im

LocalStack 13 Dec 14, 2022
Space Bot, a Discord bot built for HackerSpace Club of PES University

Space Bot Space Bot, a Discord bot built for HackerSpace Club of PES University What can Space Bot do? Space Bot allows you to lookup any mentor or to

HackerSpace @PESU 7 Oct 23, 2022
PyMusic Player is a music player written in python3.

PyMusic Player is a music player written in python3. It harvests r

PythonSerious 2 Jan 30, 2022
Neubot client

Neubot, the network neutrality bot Neubot is a research project on network neutrality of the Nexa Center for Internet & Society at Politecnico di Tori

Neubot 57 Nov 02, 2021