summaryrefslogtreecommitdiffstats
path: root/fb.py
diff options
context:
space:
mode:
Diffstat (limited to 'fb.py')
-rwxr-xr-xfb.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/fb.py b/fb.py
index d6de696..94b021f 100755
--- a/fb.py
+++ b/fb.py
@@ -79,7 +79,7 @@ class APIException(Exception):
self.error_id = error_id
class CURLWrapper:
- def __init__(self, config):
+ def __init__(self, config, args):
c = pycurl.Curl()
c.setopt(c.USERAGENT, config['useragent'])
c.setopt(c.HTTPHEADER, [
@@ -91,6 +91,7 @@ class CURLWrapper:
c.setopt(c.VERBOSE, 1)
self.config = config
+ self.args = args
self.curl = c
self.post = []
self.progressBar = ProgressBar()
@@ -126,6 +127,9 @@ class CURLWrapper:
if len(files) > self.config["min_files_per_request_default"]:
self.getServerConfig()
+ if self.args.min_id_length:
+ self.post.append(("minimum-id-length", self.args.min_id_length))
+
for file in files:
if file.should_upload():
filesize = os.stat(file.path).st_size
@@ -195,6 +199,9 @@ class CURLWrapper:
self.curl.setopt(pycurl.POST, 1)
self.__add_post(data)
+ if self.args.min_id_length:
+ self.post.append(("minimum-id-length", self.args.min_id_length))
+
self.addAPIKey()
ret = self.perform()
self.post = []
@@ -441,7 +448,7 @@ class FBClient:
def parseConfig(self, file, ignoreMissing=False):
c = ConfigParser(file, ignoreMissing=ignoreMissing)
self.config = c.get_config()
- self.config["api_url"] = self.config["pastebin"]+"/api/v2.0.0"
+ self.config["api_url"] = self.config["pastebin"]+"/api/v2.2.0"
self.config["warnsize"] = 10*1024*1024
self.config["min_files_per_request_default"] = 5
self.config["min_variables_per_request_default"] = 20
@@ -490,6 +497,8 @@ class FBClient:
help="File name to use for upload when reading from stdin (default: stdin)")
upload_options.add_argument("-e", "--extension", default="", action="store",
help="extension for default highlighting (e.g. \"diff\")")
+ upload_options.add_argument("-M", "--min-id-length", default="", action="store",
+ help="minimum length for the generated ID in the paste url")
parser.add_argument("-c", "--compress", default=0, action="count",
help="Compress the file being uploaded with gz or xz if used 2 times. "
@@ -516,7 +525,7 @@ class FBClient:
self.config["debug"] = self.args.debug
- self.curlw = CURLWrapper(self.config)
+ self.curlw = CURLWrapper(self.config, self.args)
functions = {
self.modes.upload: self.upload,