Skip to content

⭐ Source Code for the backend of psty.io. Written in Python with Flask 🐍

License

Notifications You must be signed in to change notification settings

psty-io/psty-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📝 psty.io 📝

⭐ What is psty.io? ⭐

psty is a free, open source project that provides a service for sharing and highlighting source code/plaintext. It is written in Python with the Flask framework and available for integration to your own platform. You would be able to host this anywhere. This source code is setup to run on https://psty.io but you can run it on any site by changing the domains in the files.

⭐ How does it work? ⭐

psty runs on Flask which can run on a number of platforms. I use UWSGI and Nginx to run my API through the domain but you can use other setups as well. It takes advantage of the prism.js library which will allow you to render syntax highlighted source code from a plaintext string. You can check the source code for specifics on how it works logically.

⭐ Why would I want this? ⭐

If you want to have a paste-service linked to your website that is pretty much fully customizable you can use this. This is a very easy way to share source code quickly and easily.

⭐ OpenAPI Usage ⭐

You can also hit the https://psty.io/api endpoint with a POST request to generate a paste.

Parameters:

Parameter Type Required
code string no if file provided
file file object no if code provided
lang (matches dropdown on https://psty.io) string yes

Endpoint:

https://psty.io/api

Example Response:

{
    "status": 200,
    "status_message": "Successfully created paste",
    "paste_link": "https://psty.io/p?q=3f5f",
    "raw_link": "https://psty.io/r?q=3f5f
}

Getting Started:

To start you will need somewhere to host the Flask app. This platform needs to be able to run Python 3.5.2+ and some sort of way to route the connection through a proxy pass or alt. First clone this github repository:

git clone https://github.com/M4cs/Psty-Pubilic

Then you will need to install the Python modules required:

# Using virtualenv

virtualenv .flaskapp
source .flaskapp/bin/activate # or .flaskapp/Scripts/activate.bat on Windows
pip install -r requirements.txt

Then you will need to choose either uwsgi or gunicorn to host the flask instance or you can just run:

flask run

and the app will be running on localhost:5000.

Contributors

Max Bridgland - Creator and Maintainer

About

⭐ Source Code for the backend of psty.io. Written in Python with Flask 🐍

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •