Commits

Daniel Graña  committed 7ecd760

add old pastebin.com support for intranets that still use it

  • Participants
  • Parent commits be2224c

Comments (0)

Files changed (1)

     response = urllib2.urlopen(request)
     return response.geturl()
 
+def _paste_pastebin_dixo_net(content, **parameters):
+    data = {
+            'paste': 'Send',
+            'code2': content,
+            'format': parameters['syntax'] or 'diff',
+            'expiry': 'f' if parameters['keep'] else 'm',
+            'poster': parameters.get('user', ''),
+            }
+
+    url = parameters.get('url') or pastebins['dpaste.org']['url']
+    request = urllib2.Request(url, urlencode(data))
+    _authorize_request(request, **parameters)
+    response = urllib2.urlopen(request)
+    return response.geturl()
+
+
 pastebins = {
     'dpaste': { 'url': 'http://dpaste.com/api/v1/',
                 'parameters': {
                     'optional': ['title', 'user', 'keep'], },
                 'handler': _paste_dpaste_org,
     },
+    'pastebin.dixo.net': { 'url': 'http://pastebin.dixo.net/',
+                'parameters': {
+                    'required': ['content'],
+                    'optional': ['user', 'keep'], },
+                'handler': _paste_pastebin_dixo_net,
+    },
 }
 
 def _authorize_request(request, httpauth=None, usenetrc=None, **kwargs):