예제 #1
0
def upload(file):
    # upload file to skynet
    print('uploading to skynet')
    opts = Skynet.default_upload_options
    opts.portalUrl = uploadportal
    skylink = Skynet.UploadFile(file)
    # put link into clipboard
    pyperclip.copy(linkportal + '/' + Skynet.strip_prefix(skylink))
    print('upload finished')
    # beep
    playsound(beepname, False)
    # wait for sound to play then close
    sleep(3)
예제 #2
0
from siaskynet import Skynet
import json

# upload

skylink = Skynet.UploadFile("img-data.txt")

print("Upload successful, skylink: " + skylink.replace("sia://", "https://siasky.net/"))

with open("../../address_book.json") as f:
  data = f.read()
  f.close()

  # write to values inside addressbook
  new_file = open("../../address_book.json", "w")
  new_file.write(data.replace("HAVE NOT FILLED IN NEW ADDRESS FROM UPLOAD.PY", skylink.replace("sia://", "https://siasky.net/")))
  print("Successfully changed last address\n")
예제 #3
0
 def perform_create(self, serializer):
     temp_file = self.request.data["file"]
     skylink = Skynet.UploadFile(temp_file)
     serializer.save(file=skylink, owner=self.request.user)