{% extends "dpaste/base.html" %} {% load i18n %} {% load url from future %} {% block title %}About {{ site_name }}{% endblock %} {% block headline %}About {{ site_name }}{% endblock %} {% block dpaste_nav_about %}active{% endblock %} {% block page %}

{{ site_name }} is powered by dpaste, which is open source. You can find the source, contribute to it and leave ideas on Github: github.com/bartTC/dpaste

Change the language: {% csrf_token %}

API

dpaste provides a simple API documented in detail on this page. For a quick start here is a code example (Python 2.x):

{# Just put the script in dpaste and copy the source node #}
  1. #!/usr/bin/env python
  2.  
  3. from urllib import urlencode
  4. from urllib2 import Request, urlopen
  5. from sys import stdin
  6.  
  7. def paste_code():
  8.     request = Request('https://dpaste.de/api/', urlencode({
  9.         'content': stdin.read(),
  10.         'lexer': 'python',
  11.         'format': 'url',
  12.     }))
  13.     print urlopen(request).read()
  14.  
  15. if __name__ == '__main__':
  16.     paste_code()

Save this script in /usr/local/bin/dpaste and give it the executable bit: chmod +x /usr/local/bin/dpaste.

Usage: cat foo.txt | dpaste

An alternative would be to just use curl: alias dpaste="curl -F 'content=<-' https://dpaste.de/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 4 letter code of your snippet in the field and submit. Like this yellow one here: http://dpaste.de/SiZrT

{% csrf_token %}

{{ DPASTE_ABOUT_EXTRA }}
{% endblock %}