diff --git a/cdncli.py b/cdncli.py index 03f688d..9a1e8d3 100644 --- a/cdncli.py +++ b/cdncli.py @@ -73,10 +73,11 @@ if __name__ == '__main__': mime = magic.Magic(mime=True) file_mime = mime.from_file(filepath) file = {'file': open(filepath, 'rb')} - res = requests.post(url='http://127.0.0.1:8000/uploadfile/', + res = requests.post(url='https://cdn.itguild.info/uploadfile/', files=file, data={'package': d['name'], 'version': d['version'], 'filename': args.file}) if res.ok: print(f"Successfully uploaded {filepath}") + print(res.text) else: print("Wrong") diff --git a/daemon/SimpleDaemon.py b/daemon/SimpleDaemon.py index adea5f8..43826a2 100644 --- a/daemon/SimpleDaemon.py +++ b/daemon/SimpleDaemon.py @@ -40,7 +40,7 @@ class Daemon: sys.exit(1) # decouple from parent environment - os.chdir('/') + # os.chdir('/') os.setsid() os.umask(0) diff --git a/server.py b/server.py index 5aefc01..53831af 100644 --- a/server.py +++ b/server.py @@ -43,8 +43,8 @@ async def create_upload_file(file: UploadFile | None, package: Annotated[str, Fo os.makedirs(dir_file) with open(f"{dir_file}/{filename}", 'wb') as f: f.write(contents) - except Exception: - return {"message": "There was an error uploading the file"} + except Exception as err: + return {"message": "There was an error uploading the file, error {err}".format(err=err)} finally: file.file.close() @@ -52,4 +52,4 @@ async def create_upload_file(file: UploadFile | None, package: Annotated[str, Fo if __name__ == "__main__": - uvicorn.run("server:app", port=5000, log_level="info") \ No newline at end of file + uvicorn.run("server:app", port=5044, log_level="info") \ No newline at end of file