1
1
mirror of https://github.com/r4sas/PBinCLI synced 2025-01-24 21:44:27 +00:00
PBinCLI/pbincli/api.py
2018-05-23 04:14:35 -04:00

28 lines
850 B
Python

import requests
class PrivateBin:
def __init__(self, server, proxy=None):
self.server = server
self.headers = {'X-Requested-With': 'JSONHttpRequest'}
if proxy:
self.proxy = {proxy.split('://')[0]: proxy}
else:
self.proxy = {}
def post(self, request):
r = requests.post(url = self.server, headers = self.headers, proxies = self.proxy, data = request)
return r.text
def get(self, request):
url = self.server + "?" + request
r = requests.get(url = url, headers = self.headers, proxies = self.proxy)
return r.text
def delete(self, pasteid, token):
request = {'pasteid':pasteid,'deletetoken':token}
r = requests.post(url = self.server, headers = self.headers, proxies = self.proxy, data = request)
return r.text