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 Radio in Voice Chats. This is also the source code of the userbot which is being used for playing Radio in @AsmSafone Channel.

Telegram Radio Player UserBot A Telegram UserBot to Play Radio in Channel or Group Voice Chats. This is also the source code of the userbot which is b

SAF ONE 44 Nov 12, 2022
A fully responsive interface to manage all your favorite software on your HTPC.

Python 3 port of Hellowlol's HTPC Manager fork We made this an organization repository to be more independent from single developers. If you want to j

26 Jan 04, 2023
Reddit bot for r/khiphop

khiphop-bot Description This project is a collection of scripts that better the state of the r/khiphop subreddit, which represents Korean Hip-Hop and

1 Dec 21, 2021
Video Bot: an Advanced Telegram Bot that's allow you to play Video & Music on Telegram Group Video Chat

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

5 Jan 26, 2022
Discord bot for polls and votes including STV. Supports hiding results and is written with Discord.py

VoteBot Discord voting bot capable of standard polls, as found in many other bots; anonymous polls, where votes are hidden and totals are only display

6 Nov 15, 2022
A script written in python3 for bruteforcing Gmail accounts.

GmailBruteforce Made for bruteforcing gmail accounts. It needs Less Secure Apps setting turned on in order to work. Installation For windows git clone

Shinero 4 Sep 16, 2022
An advanced Twitter scraping & OSINT tool written in Python that doesn't use Twitter's API, allowing you to scrape a user's followers, following, Tweets and more while evading most API limitations.

TWINT - Twitter Intelligence Tool No authentication. No API. No limits. Twint is an advanced Twitter scraping tool written in Python that allows for s

TWINT Project 14.2k Jan 03, 2023
Modified Version of mega.py package for Pyrogram Bots

Pyro Mega.py Python library for the Mega.co.nz API, currently supporting: login uploading downloading deleting searching sharing renaming moving files

I'm Not A Bot #Left_TG 10 Aug 03, 2022
TeslaPy - A Python implementation based on unofficial documentation of the client side interface to the Tesla Motors Owner API

TeslaPy - A Python implementation based on unofficial documentation of the client side interface to the Tesla Motors Owner API, which provides functiona

Tim Dorssers 233 Dec 30, 2022
Django3 web app that renders OpenWeather API data ☁️☁️

nz-weather For a live build, visit - https://brandonru.pythonanywhere.com/ NZ Openweather API data rendered using Django3 and requests ☀️ Local Run In

Brandon Ru 1 Oct 17, 2021
EpikCord.py - This is an API Wrapper for Discord's API for Python

EpikCord.py - This is an API Wrapper for Discord's API for Python! We've decided not to fork discord.py and start completely from scratch for a new, better structuring system!

EpikHost 28 Oct 10, 2022
SEBUAH TOOLS CRACK FACEBOOK & INSTAGRAM DENGAN FITUR YANGMENDUKUNG

SEBUAH TOOLS CRACK FACEBOOK & INSTAGRAM DENGAN FITUR YANGMENDUKUNG

Jeeck X Nano 1 Dec 27, 2021
Bot developed in python, 100% open-source, compatible with Windows and Linux.

Bombcrypto Bot [Family JOW] Bot desenvolvido em python, 100% do código é aberto, para aqueles que tenham conhecimento validarem que não existe nenhum

Renato Maia 71 Dec 20, 2022
This Server Cloner can clone the server you want with all the perms of roles in every particular channel.

Server-Cloner-with-perms 🚀 This Server Cloner can clone the server you want with all the perms of roles in every particular channel. Features Clone C

Gripz 0 Feb 17, 2022
A Python script to update Spotify Playlist data every 5 minutes.

Spotify Playlist Updater A Python script to update Spotify Playlist data every 5 minutes. Description An automatic playlist updater using Spotify API

6 Nov 24, 2022
TeamDltvideo Bot you can add in your Telegram Group Thanks

TeamDltvideo TeamDltvideo Bot you can add in your Telegram Group Thanks Video Stream is a telegram bot project that's allow you to play video on teleg

TeamDlt 1 Nov 18, 2021
Wrapper for the Swiss Parliament API for Python

swissparlpy This module provides easy access to the data of the OData webservice of the Swiss parliament. Table of Contents Installation Usage Get tab

Stefan Oderbolz 8 Jun 13, 2022
Baota-docker - Deploying baota panel via docker

baota-docker Deploying baota panel via docker. 通过docker一键部署宝塔面板。 一、前言 好像很多人对这个感兴

Mr. Cat 15 Dec 12, 2022
Lamblayer: a minimal deployment tool for AWS Lambda layers

lamblayer lamblayer is a minimal deployment tool for AWS Lambda layers. lamblayer does, Create a Layers of built pip-installable python packages. Crea

Yusuke Takahashi 2 Aug 19, 2022
One version package to rule them all, One version package to find them, One version package to bring them all, and in the darkness bind them.

AwesomeVersion One version package to rule them all, One version package to find them, One version package to bring them all, and in the darkness bind

Joakim Sørensen 39 Dec 31, 2022