chatgpt/pastedb/pastedb01/services/defau.py

27 lines
629 B
Python
Raw Normal View History

import requests
import json
import hashlib
def serviceTag():
return 'p.defau.lt'
def upload(data):
json_data = json.dumps(data)
md5sum = hashlib.md5(json_data.encode('utf-8')).hexdigest()
url = 'https://p.defau.lt/submit.php'
response = requests.post(url, data={'code': json_data})
if response.status_code == 200:
key = response.url
name = 'defau_' + md5sum[:5]
return {'name': name, 'service': 'p.defau.lt', 'key': key, 'md5sum': md5sum}
else:
return None
def get(trace):
url = trace[key]
response = requests.request.get(url)
return response.content