I'm very new to Python and Web programming. I was given a task to upload new server builds to Playfab automatically - as my very first introductory task to Web programming.
My Question:
After getting an upload url from Play fab I'm trying to send it a .zip file with server build. But for some reason I'd always get 10054 Error
After looking at given documentation on how to upload custom server from Playfab I just cannot understand why I get kicked from server.
Here is the code that I'm using to upload:
def UploadZipFile(url_):
with open('D:/Bla/Bla/Bla/Server/TestServer.zip', 'rb') as _file:
# If we got URL
if url_ is not None:
_header = {
"Content-Type": "application/x-zip-compressed",
"X-SecretKey": "TheKey"
}
_uploadRequest = requests.post(url_, data=_file, headers=_header)
print _uploadRequest
if _uploadRequest.status_code is not 200:
print 'Could not upload file to server, response code {0}'.format(_uploadRequest.status_code)
return False
else:
print 'Uploading files to server'
return True
else:
print 'Got bad Upload URL'
return False
This is very much a test code that I use. Not going into production.
To POST requests I'm using Requests Library
Thank you very much.
Aucun commentaire:
Enregistrer un commentaire