Project update not working with 1.49 anymore
Hi, we are using a script that auto uploads new projects to our 4 servers. Today I updated one of them to 1.49 for testing and the upload does not work anymore. It is done via POST call, uploading a zip.
Being logged in with a browser works just fine, but not with the script anymore while the upload on the other 3 servers work like a charm (1.46 works).
I compared both post calls with firefox dev tools and could not find any difference, I am a bit out of ideas.
What could the issue be?
This is the python code we are using.
def uploadToServer(self):
print("{}: Uploading project to server...".format(self.server_name))
upload_url = 'https://{}:{}/project/{}/import/1'.format(server, self.server_port, self.server_uuid)
upload_post_data = {'a': 'uploadZIP', 'name': os.path.basename(self.zip_file)}
with open(self.zip_file, 'rb') as upload_file: # open file in read binary mode
post_result = requests.post(upload_url, data = upload_post_data, files={'': upload_file}, headers= {'x-api-key': self.server_api_key})
post_result = json.loads(post_result.text)
if "ok" in post_result and post_result['ok'] == True:
print("{}: Upload successful.".format(self.server_name))
else:
print("{}: Upload failed: {}".format(self.server_name, post_result['error'] if "error" in post_result else post_result))
print(post_result)
return False
return True
Comments
Can't say how you tell python to assign the file that parameter name, but since I don't see you using it anywere I guess that is why it fails.