Giter VIP home page Giter VIP logo

psty-api's Introduction

📝 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

psty-api's People

Contributors

bendamschke avatar frenchie0x4ff avatar m4cs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

psty-api's Issues

Can't build flask app with requirements of guesslang 0.9.3

When trying to resolve dependencies of modules via pip

# pip install -r requirements.txt
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Requirement already satisfied: absl-py==0.7.1 in ./.flaskapp/lib/python2.7/site-packages (from -r requirements.txt (line 1)) (0.7.1)
Requirement already satisfied: aniso8601==7.0.0 in ./.flaskapp/lib/python2.7/site-packages (from -r requirements.txt (line 2)) (7.0.0)
Requirement already satisfied: astor==0.8.0 in ./.flaskapp/lib/python2.7/site-packages (from -r requirements.txt (line 3)) (0.8.0)
Requirement already satisfied: Click==7.0 in ./.flaskapp/lib/python2.7/site-packages (from -r requirements.txt (line 4)) (7.0)
Requirement already satisfied: Flask==1.0.3 in ./.flaskapp/lib/python2.7/site-packages (from -r requirements.txt (line 5)) (1.0.3)
Requirement already satisfied: Flask-RESTful==0.3.7 in ./.flaskapp/lib/python2.7/site-packages (from -r requirements.txt (line 6)) (0.3.7)
Requirement already satisfied: gast==0.2.2 in ./.flaskapp/lib/python2.7/site-packages (from -r requirements.txt (line 7)) (0.2.2)
Requirement already satisfied: grpcio==1.21.1 in ./.flaskapp/lib/python2.7/site-packages (from -r requirements.txt (line 8)) (1.21.1)
Requirement already satisfied: h5py==2.9.0 in ./.flaskapp/lib/python2.7/site-packages (from -r requirements.txt (line 9)) (2.9.0)
ERROR: Could not find a version that satisfies the requirement guesslang==0.9.3 (from -r requirements.txt (line 10)) (from versions: 0.9.0rc5, 0.9.1, 2.0.0a1, 2.0.0, 2.0.1, 2.0.3, 2.2.0, 2.2.1)
ERROR: No matching distribution found for guesslang==0.9.3 (from -r requirements.txt (line 10))


Tried to change version of guesslang to 0.9.1, 2.0.0 or so, got some another errors

# pip install guesslan
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting guesslang
  Using cached guesslang-2.2.1.tar.gz (2.6 MB)
    ERROR: Command errored out with exit status 1:
     command: /home/username/psty-api/.flaskapp/bin/python2 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-tU4xYL/guesslang/setup.py'"'"'; __file__='"'"'/tmp/pip-install-tU4xYL/guesslang/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-1qgHB3
         cwd: /tmp/pip-install-tU4xYL/guesslang/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-tU4xYL/guesslang/setup.py", line 24
        def version(base_module: str) -> str:
                               ^
    SyntaxError: invalid syntax
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

The psty.io domain expired

When visiting psty.io the page displays:

"psty.io - This Domain Name Has Expired - Renewal Instructions "

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.