28 lines
792 B
Python
28 lines
792 B
Python
from typing import Dict
|
|
from services import pastie, dpaste, rentry, defau, sprunge, opendev
|
|
from data.data import add_data, save_data, set_encryption_key
|
|
|
|
|
|
def upload_and_store(data: Dict):
|
|
# set encryption key if necessary
|
|
my_key = b'upload_id=upload_and_store(my_da'
|
|
set_encryption_key(my_key)
|
|
|
|
traces = {}
|
|
for service in [pastie, dpaste, rentry, defau, sprunge, opendev]:
|
|
result = service.upload(data)
|
|
if result:
|
|
traces[result['name']] = result['key']
|
|
add_data(service.get_service_tag(), result['name'], result['md5sum'])
|
|
save_data('data.json', data, key=my_key)
|
|
return traces
|
|
|
|
my_data = {"name": "Sashenka", "age": 26, "country": "Anguilla"}
|
|
|
|
|
|
|
|
upload_trace = upload_and_store(my_data)
|
|
|
|
print('trace: ', upload_trace)
|
|
|