{% extends "base.html" %} {% load i18n %} {% block title %}About {{ LIBPASTE_SITENAME }}{% endblock %} {% block headline %}About {{ LIBPASTE_SITENAME }}{% endblock %} {% block page %}

xelpaste is open source. You can find the source, contribute to it and leave ideas on Github: github.com/rbarrois/xelpaste.
It is based on the excellent dpaste project.

API

{# Just put the script in xelpaste and copy the source node #}
  1. #!/usr/bin/env python
  2.  
  3. import urllib
  4. import urllib2
  5. import sys
  6.  
  7. def paste_code():
  8.    request = urllib2.Request(
  9.        '{{ LIBPASTE_BASE_URL }}/api/',
  10.        urllib.urlencode([('content', sys.stdin.read())]),
  11.    )
  12.    response = urllib2.urlopen(request)
  13.    # Strip surrounding quotes (NB: response has no trailing newline)
  14.    print response.read()[1:-1]
  15.  
  16. if __name__ == '__main__':
  17.    paste_code()

Save this script in /usr/local/bin/xelpaste and chmod +x ..filepath.

Usage: cat foo.txt | xelpaste

Or you could use curl: alias xelpaste="curl -F 'content=<-' {{ LIBPASTE_BASE_URL }}/api/"

Applications using the API:

{% trans "Statistics" %}

{% blocktrans %}There are {{ total }} snippets in the database. The most popular languages are:{% endblocktrans %}

{% for s in stats %} {% endfor %}
{{ s.lexer|upper }} {{ s.count }}

Delete a snippet

If you created a snippet with the API you can't delete it on the webpage since it's not in your history. You can delete a snippet here. Actually you can delete any snippet of anybody, as long as you know the short code.

If you deleted a snippet because of legal issues, please let me know that, I want to keep track of such things and try to avoid in future.

Type the {{ LIBPASTE_SLUG_LENGTH }} letter code of your snippet in the field and submit. Like this yellow one here: {{ LIBPASTE_BASE_URL }}/SiZr

{% csrf_token %}
{% endblock %}