FIxed a handful of bugs and made the bash script useful.
FIxed a handful of bugs and made the bash script useful.

--- a/KerbalStuff/ReadOnly.py
+++ b/KerbalStuff/ReadOnly.py
@@ -8,7 +8,7 @@
 from StaticClass import staticclass

 

 Constants.RootUri = "https://kerbalstuff.com"

-Constants.ApiUri = self.RootUri + "/api"

+Constants.ApiUri = Constants.RootUri + "/api"

 Constants.UserAgent = "PyKStuff by toadicus"

 

 Constants.browse_new = Constants.format_action("/browse/new?page={0:d}")


--- a/KerbalStuff/ReadWrite.py
+++ b/KerbalStuff/ReadWrite.py
@@ -88,7 +88,7 @@
         with open(file_path, 'rb') as zip_file:

             if not zipfile.is_zipfile(zip_file):

                 raise IOError("File at path '{0}' is not a valid zip file.".format(file_path))

-            files['zipball'] = (file_name, zip_file.readall(), 'application/zip')

+            files['zipball'] = (file_name, zip_file.read(), 'application/zip')

 

         cls.do_post_request(Constants.mod_create, data=data, files=files, cookies=cls.current_cookies)

 

@@ -99,6 +99,7 @@
 

     @classmethod

     def mod_update(cls, mod_id: int, mod_version: ModVersion, notify_followers: bool, file_name: str, file_path: str):

+        mod_id = int(mod_id)

         if mod_version is None or not isinstance(mod_version, ModVersion):

             raise TypeError("mod_version must be a valid ModVersion object")

         if mod_version.friendly_version is None or len(mod_version.friendly_version) == 0:

@@ -126,9 +127,9 @@
         with open(file_path, 'rb') as zip_file:

             if not zipfile.is_zipfile(zip_file):

                 raise IOError("File at path '{0}' is not a valid zip file.".format(file_path))

-            files['zipball'] = (file_name, zip_file.readall(), 'application/zip')

+            files['zipball'] = (file_name, zip_file.read(), 'application/zip')

 

-        cls.do_post_request(Constants.mod_update, mod_id, data=data, files=file, cookies=cls.current_cookies)

+        cls.do_post_request(Constants.mod_update, mod_id, data=data, files=files, cookies=cls.current_cookies)

 

         if cls.current_json is not None:

             return cls.current_json


--- a/PyKStuff.py
+++ b/PyKStuff.py
@@ -276,6 +276,7 @@
 

     try:

         KerbalStuff.mod_update(args.mod_id, ver, args.notify, file_name, file_path)

+        print(KerbalStuff.current_json)

     except TypeError as x:

         sys.stderr.write(x)

         sys.exit(1)


file:a/ks -> file:b/ks
--- a/ks
+++ b/ks
@@ -1,3 +1,5 @@
-#!/bin/bash

-

-python3 PyKStuff.py $*
+#!/bin/bash
+
+scriptdir=$(dirname $(readlink -f $0))
+
+python3 "$scriptdir"/PyKStuff.py $*