1
1
mirror of https://github.com/r4sas/PBinCLI synced 2025-01-11 07:17:52 +00:00
PBinCLI/pbincli/transports.py

29 lines
903 B
Python
Raw Normal View History

2017-02-19 10:26:22 +00:00
import requests
2017-03-02 10:09:52 +00:00
import pbincli.settings
2017-02-20 17:56:37 +00:00
class privatebin(object):
2017-02-19 10:26:22 +00:00
def __init__(self):
2017-03-02 10:09:52 +00:00
self.server = pbincli.settings.server
2017-02-19 10:26:22 +00:00
self.headers = {'X-Requested-With': 'JSONHttpRequest'}
2018-02-12 14:28:18 +00:00
if pbincli.settings.useproxy:
self.proxies = pbincli.settings.proxies
else:
self.proxies = {}
2017-02-20 12:13:42 +00:00
def post(self, request):
2017-03-02 10:09:52 +00:00
r = requests.post(url = self.server, headers = self.headers, proxies = self.proxies, data = request)
return r.text
2017-02-20 12:13:42 +00:00
def get(self, request):
url = self.server + "?" + request
2017-03-02 10:09:52 +00:00
r = requests.get(url = url, headers = self.headers, proxies = self.proxies)
2017-02-20 12:13:42 +00:00
return r.text
2017-02-20 17:56:37 +00:00
def delete(self, pasteid, token):
request = {'pasteid':pasteid,'deletetoken':token}
2017-03-02 10:09:52 +00:00
r = requests.post(url = self.server, headers = self.headers, proxies = self.proxies, data = request)
2017-02-20 12:13:42 +00:00
return r.text