mirror of
https://github.com/ChronosX88/PyNesca.git
synced 2024-11-22 13:12:18 +00:00
8e1fc5a369
in config.
22 lines
735 B
Python
22 lines
735 B
Python
from core.prototypes.AbstractStorage import AbstractStorage
|
|
import json
|
|
class GDocsStorage(AbstractStorage):
|
|
def __init__(self, path:"path"):
|
|
self.path = path
|
|
self.urls = dict()
|
|
def put_responce(self, url:'url', status:'status', title:'gdoc_title',
|
|
info:'gdoc_info'):
|
|
if str(status) not in self.urls.keys():
|
|
self.urls[str(status)] = dict()
|
|
print(int(status))
|
|
url_object = dict()
|
|
if status == 200:
|
|
url_object = info
|
|
url_object["title"] = title
|
|
self.urls[str(status)][url] = url_object
|
|
def save(self):
|
|
print("saving")
|
|
with open(self.path, "w") as f:
|
|
json.dump(self.urls, f)
|
|
self.urls = dict()
|