An unofficial wrapper for Engineer Man's Piston API

Overview

Pistonpy


Pistonpy is an API wrapper for the Piston code execution engine by Engineer Man.

Key Features

  • Simple modern and efficient Pythonic API using the requests lib.
  • Supports application integration and CLI usage.

Requirements

Python 3.8+

Installing

To install the library, run the following commands:

# Linux/MacOS
python3 -m pip install -U pistonpy

# Windows
py -3 -m pip install -U pistonpy

Usage

from pistonpy import PistonApp

# Initialize the client.
piston = PistonApp()

my_code = "print('This code ran from app.py itself!')"

output = piston.run(language="python", version="3.10.0", code=my_code)

print(output)

This gives the output:

{'language': 'python', 'version': '3.10.0', 'run': {'stdout': 'This code ran from app.py itself!\n', 'stderr': '', 'code': 0, 'signal': None, 'output': 'This code ran from app.py itself!\n'}}
run_file = piston.run(language="python", files=['test.py']) # version is optional. files even if it maybe only one must be given as lists.

print(run_file)

This gives the same output,

{'language': 'python', 'version': '3.10.0', 'run': {'stdout': 'The code ran from test.py\n', 'stderr': '', 'code': 0, 'signal': None, 'output': 'The code ran from test.py\n'}}
# You cannot provide both code and files in a single PistonAPP().run() instance.

# For running multiple files (For now it ONLY supports multiple python files)

multiple_files = piston.run(language="python", version="3.10.0", files=['test.py', 'test_two.py'])

print(multiple_files)

Sadly, the output for multiple files are provided all-together. This will be fixed in the upcoming updates. The above statement will output to:

{'language': 'python', 'version': '3.10.0', 'run': {'stdout': 'The code ran from test.py\nthis is test 2\n', 'stderr': '', 'code': 0, 'signal': None, 'output': 'The code ran from test.py\nthis is test 2\n'}}
print(piston.languages) # Prints the available languages along with their version.

print(piston.aliases) # Prints the available languages along with their alias/aliases.

print(piston.raw) # Prints the raw data without any formatting done.

License

This project is distributed under the MIT license.

Piston

For visiting Piston's github repository, click here.

You might also like...
rewise is an unofficial wrapper for google search's auto-complete feature

rewise is an unofficial wrapper for google search's auto-complete feature

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

Async ready API wrapper for Revolt API written in Python.

Mutiny Async ready API wrapper for Revolt API written in Python. Installation Python 3.9 or higher is required To install the library, you can just ru

An API Wrapper for Gofile API

Gofile2 from gofile2 import Gofile g_a = Gofile() print(g_a.upload(file="/home/itz-fork/photo.png")) An API Wrapper for Gofile API. About API Gofile

A simple API wrapper for the Tenor API

Gifpy A simple API wrapper for the Tenor API Installation Python 3.9 or higher is recommended python3 -m pip install gifpy Clone repository: $ git cl

A Python API wrapper for the Twitter API!

PyTweet PyTweet is an api wrapper made for twitter using twitter's api version 2! Installation Windows py3 -m pip install PyTweet Linux python -m pip

Releases(v0.0.3)
  • v0.0.3(Dec 7, 2021)

    Notable Changes

    • Added greater control over <PistonApp>.languages property by splitting it into three detailed commands.
    • Pistonpy now supports providing multiple files(python only) with <PistonApp>.run().
    • Added extensions file & Extensions class for formatting data.
    • Added MultipleLanguagesFound exception.
    • The next version will have much more updates and will take more time to publish.

    Full Changelog: https://github.com/AalbatrossGuy/pistonpy/blob/main/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v0.0.2(Dec 5, 2021)

    Notable Changes

    • The first release of pistonpy! πŸŽ‰
    • Pistonpy can now run 51+ languages mentioned here
    • It can run raw code provided as a variable or run code provided as a file.
    • Custom and well defined error messages to help debug.

    Full Changelog: https://github.com/AalbatrossGuy/pistonpy/commits/v0.0.2

    Source code(tar.gz)
    Source code(zip)
Owner
AalbatrossGuy
Just A Programmer....
AalbatrossGuy
A Telegram Userbot to play Audio and Video songs / files in Telegram Voice Chats

TG-MusicPlayer A Telegram Userbot to play Audio and Video songs / files in Telegram Voice Chats. It's made with PyTgCalls and Pyrogram Requirements Py

MᴏᴏɴʟΙͺΙ’Κœα΄› 4 Dec 14, 2022
Drover is a command-line utility for deploying Python packages to Lambda functions.

drover drover: a command-line utility for deploying Python packages to Lambda functions. Background This utility aims to provide a simple, repeatable,

Jeffrey Wilges 4 May 19, 2021
This is a Anti Channel Ban Robots

AntiChannelBan This is a Anti Channel Ban Robots delete and ban message sent by channels Heroku Deployment πŸ’œ Heroku is the best way to host ur Projec

BᡣₐyDβ‚‘β‚™ 25 Dec 10, 2021
A modular dynamical-systems model of Ethereum's validator economics.

CADLabs Ethereum Economic Model A modular dynamical-systems model of Ethereum's validator economics, based on the open-source Python library radCAD, a

CADLabs 104 Jan 03, 2023
Send to Telegram, Vk, Discord

Triple send ВСрсия для русских: здСсь Demo: Telegram: @Triple_project_bot Discord: Triple project#0877 Vkontakte: @dev.santaspeen How to run Install r

2 Sep 27, 2022
Video Stream: an Advanced Telegram Bot that's allow you to play Video & Music on Telegram Group Video Chat

Video Stream is an Advanced Telegram Bot that's allow you to play Video & Music

SHU KURENAI TEAM 4 Nov 05, 2022
A Telegram Bot Written In Python

TelegraphUploader A Telegram Bot Written In Python DEPLOY Local Machine Clone the repository Install requirements: pip3 install -r requirements.txt e

Wahyusaputra 2 Dec 29, 2021
Authenticate your League of legends account on riot client in a few lines of code.

lol-authenticator v1.0.0 Content index Project Setup Dependencies Project Setup Dependencies Python v3.9.6 If you don't have Python installed on your

CΓ‘ssio Fontoura 5 Aug 28, 2022
Decrypt PSSE layer of PSM Games (on PC)

psse-decrypt Decrypt PSSE layer of PSM Games (on PC) Works on Unity and PSM games, and meets all requirements of: https://github.com/vita-nuova/bounti

Bluzume 32 Oct 11, 2022
Unirest in Python: Simplified, lightweight HTTP client library.

Unirest for Python Unirest is a set of lightweight HTTP libraries available in multiple languages, built and maintained by Mashape, who also maintain

Kong 432 Dec 21, 2022
πŸ•΅οΈβ€β™‚οΈ Investigate Google Accounts with emails.

Description GHunt is an OSINT tool to extract information from any Google Account using an email. It can currently extract: Owner's name Last time the

mxrch 13.1k Jan 01, 2023
Aws-cidr-finder - A Python CLI tool for finding unused CIDR blocks in AWS VPCs

aws-cidr-finder Overview An Example Installation Configuration Contributing Over

Cooper Walbrun 18 Jul 31, 2022
A python library for creating selfbots/automating your Nertivia account.

nertivia-selfbot (WIP) A python library for creating selfbots/automating your Nertivia account. how to use Download the nertivia_selfbot folder from t

Ben Tettmar 2 Feb 03, 2022
Guilherme Matheus 11 Sep 11, 2022
ShoukoKomiRobot - An anime themed telegram bot that can convert telegram media

ShoukoKomiRobot β€’ π•Žπ•£π•šπ•₯π•₯π•–π•Ÿ π•€π•Ÿ Python3 β€’ π•ƒπ•šπ•“π•£π•’π•£π•ͺ π•Œπ•€π•–π•• Pyrogram

25 Aug 14, 2022
This package allows interactions with the BuyCoins API.

The BuyCoins Python library allows interactions with the BuyCoins API from applications written in Python.

Abdulazeez Abdulazeez Adeshina 45 May 23, 2022
Discord Token Generator - Python (Generates Tokens and Joins your Server Automatically) hCaptcha Bypass **FREE**

Best Discord Token Generator {hCaptcha bypass FREE Unlimited Memberboost} Install few requirements & run main.py it will redirect you to the Download

1 Oct 27, 2021
Roaster - this gui app + program bundle roasts.

Roaster - this gui app + program bundle roasts.

Harsh ADV) 1 Jan 04, 2022
A Telegram user bot to count telegram channel subscriber or group member.

Subscriber Count Userbot A Telegram user bot to count telegram channel subscriber or group member. This tool is only for educational purpose. You coul

IDNCoderX 8 Nov 30, 2022
SpotPlay2YouPlay - Converts new additions to a Spotify playlist to a matching Youtube playlist

SpotPlay2YouPlay - Converts new additions to a Spotify playlist to a matching Youtube playlist, can also be configured to converting whole playlists with the refresh fun

9 Mar 06, 2022