#1: push main.py
Some checks reported errors
continuous-integration/drone/push Build was killed
Some checks reported errors
continuous-integration/drone/push Build was killed
This commit is contained in:
20
BringCookies/main.py
Normal file
20
BringCookies/main.py
Normal file
@ -0,0 +1,20 @@
|
||||
import os
|
||||
import requests
|
||||
|
||||
def main():
|
||||
env = os.environ
|
||||
sourcePath = env["PLUGIN_SOURCEPATH"]
|
||||
destinationPath = env["PLUGIN_DESTINATIONPATH"]
|
||||
nextcloudInstance = env["PLUGIN_NEXTCLOUDINSTANCE"]
|
||||
user = env["PLUGIN_USER"]
|
||||
password = env["PLUGIN_PASSWORD"]
|
||||
protocol = env["PLUGIN_PROTOCOL"]
|
||||
verifyTls = env["PLUGIN_VERIFYTLS"]
|
||||
filecontent = open(sourcePath, "rb")
|
||||
copy(nextcloudInstance, user, destinationPath, filecontent, password, protocol, verifyTls)
|
||||
|
||||
def copy(nc, user, pathtofile, filecontent, password, protocol, verifyTls):
|
||||
journey = requests.put(protocol + "://" + nc + "/remote.php/dav/files/" + user + "/" + pathtofile, data=filecontent, auth=(user, password), verify=verifyTls)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Reference in New Issue
Block a user