summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2020-10-11 10:52:59 +0200
committerFlorian Pritz <bluewind@xinu.at>2020-10-11 10:52:59 +0200
commit75da052b8093ea96f68702a1e7cbf628d8d8869b (patch)
tree6c383082f219e67bb4a771b12b1e69ffb41bf85b
parent83b303b52da08599d038e39f6a26ea74d4e7eaca (diff)
Only request API 2.2.0 when necessaryHEADv2.1.1master
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-xfb.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/fb.py b/fb.py
index ab1ace9..8f24013 100755
--- a/fb.py
+++ b/fb.py
@@ -107,6 +107,12 @@ class CURLWrapper:
self.serverConfig = CURLWrapper(self.config, self.args).send_get("/file/get_config")
return self.serverConfig
+ def getApiUrl(self):
+ if self.args.min_id_length:
+ return self.config["pastebin"]+"/api/v2.2.0"
+ else:
+ return self.config["pastebin"]+"/api/v2.0.0"
+
def upload_files(self, files):
"""
Upload files if f.should_upload() for f in files is true.
@@ -171,7 +177,7 @@ class CURLWrapper:
return files
def send_get(self, url):
- self.curl.setopt(pycurl.URL, self.config["api_url"] + url)
+ self.curl.setopt(pycurl.URL, self.getApiUrl() + url)
return self.perform()
def send_get_simple(self, url):
@@ -185,7 +191,7 @@ class CURLWrapper:
return ret
def send_post_noauth(self, url, data = []):
- self.curl.setopt(pycurl.URL, self.config["api_url"] + url)
+ self.curl.setopt(pycurl.URL, self.getApiUrl() + url)
self.curl.setopt(pycurl.POST, 1)
self.__add_post(data)
@@ -195,7 +201,7 @@ class CURLWrapper:
def send_post(self, url, data = []):
- self.curl.setopt(pycurl.URL, self.config["api_url"] + url)
+ self.curl.setopt(pycurl.URL, self.getApiUrl() + url)
self.curl.setopt(pycurl.POST, 1)
self.__add_post(data)
@@ -448,7 +454,6 @@ 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.2.0"
self.config["warnsize"] = 10*1024*1024
self.config["min_files_per_request_default"] = 5
self.config["min_variables_per_request_default"] = 20