Features
Games
Add-ons
Docs
Pricing
Forums
Blog
Log in
Sign Up

Features

Games

Add-ons

Docs

Pricing

Support

Blog

Log in

Sign Up

  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Ideas
    • Articles
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by Zhi Kang Shao · Feb 15, 2017 at 02:00 PM · Custom Game Servers

Trouble uploading a server build via Python

I'm trying to upload a server build to a URL retrieved via GetServerBuildUploadUrl(). The retrieved URL seems valid, but I'm having issues uploading to it. I've written the following Python script to attempt this:

http://pastebin.com/MXCfzUms

The retrieved URL, stored in the script as 'upload_url', is for example:

https://gamebuild-playfab-live.s3-us-west-2.amazonaws.com/####/Build001.zip?AWSAccessKeyId=ASIAJH2XGARXIQSQPZTA&Expires=1487168042&x-amz-security-token=FQoDYXdzEBYaDIbC0v9iDLrvtydDUSK3AwJX%2BdRfowazC13bYm%2F22ZZ8E3h6pdKMOGIx598ks%2FrY%2Bcgb8qFz5SLUBchpCjBaewir%2BVzigNkTXTJzPmdWfdk0ABLfEOaJW4MVSQw9TdkF8CuMX4k4iKFA2uwrHJfJGPaoIPUX64AkrnnctLDrr9%2BMMbz2gHP5Qr5MR2Rio12WgIrefraR3UztaLQWBaqVOgaFbTvzmuX7bhtKjwZ1J%2F%2FXXY5rB8hCHd2isDpy0e4QiE5Ftc95Q1XyvZZ1Mo9l0xn2ShySUzc8JJeN0X%2FtmYLAWk7dSjXLRH4X0m%2BDKsp5I%2FJay6YxHFtnZnuI174g%2BrjmHgd2hhEYUMXeervRx60dAeHYhzfP51KvPbEoCm5tNc3f18gC8Fx3MVIz3sifoSADFcVMQjd8bxAgQn0Gukf%2BT9%2BRbeoboJbneDgtxmQEdTxMXFQyacupeS6%2ByI3tmlGNDN4oBEWsSMb%2FR0NlibZBHVWIuXDzL2E5Y3s5P%2FbKhw2yITSYB46hsrZ1tP9HlxI1zLjEc6y9TGrdjt5GAbRtom%2FbwIts674PM3kkTKfM6z4baFH9Hud9MMOsVzJf2BiD2cV95GMo9JGRxQU%3D&Signature=pC%2FKKsQ3Jo1k2amzIAWUdFSdmgg%3D

with #### being the title ID of our game on PlayFab. I'm trying to upload a file directly to that URL, assuming that any authentication is already handled via the URL. Is that assumption correct?

I'm getting a 403 from Amazon with the error message 'The request signature we calculated does not match the signature you provided. Check your key and signing method.'

I should note that I'm not that familiar with HTTP requests nor Python, so I'm hoping anyone can point out something I'm blatantly doing wrong. :) We're using Jenkins, so if there is a more recommended way to automate the uploading of server builds from Jenkins I'd be happy to hear it too.

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Zhi Kang Shao · Feb 16, 2017 at 01:15 PM

Although that gave the same 403 error, it did put me in the right direction. I wasn't using the right syntax for specifying the upload type (in the body instead of the header). This next snippet worked:

headers = {
	'Content-Type': 'application/x-zip-compressed'
}
with open('TestFile.zip', 'rb') as data:
	r = put(upload_url, data=data, headers=headers)

Thanks for the help!

Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by Brendan · Feb 15, 2017 at 08:41 PM

We use pre-signed URLs for S3 uploads, for security. Unfortunately, the requests post method in your code is attempting to do a multi-part file upload against that, which isn't going to work. Could you try this?

with open('TestFile.zip', 'rb') as data:
    requests.put(upload_url, data=data)
Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • Follow this Question

    Answers Answers and Comments

    1 Person is following this question.

    avatar image

    Related Questions

    Custom pure c# server (Non Unity based) 1 Answer

    Can't matchmake to server 1 Answer

    Some question before using Playfab for an online mobile game 1 Answer

    Is there a way to receive GET requests on the PlayFab Server? 1 Answer

    UnityNetworkManagerMediator talk to Custom Mediator? 1 Answer

    Tickets

    Need help with a confidential issue? We've got your back!

  • Create Ticket
  • View Open Tickets
  • Stay up-to-date with the latest from PlayFab:  
    Sign up for newsletter
    Engineers
    • Documentation
    • Tutorials
    • API Reference
    • SDKs
    • Usage Limits
    PLAYFAB
    • Features
    • Games
    • Add-ons
    • Pricing
    Support
    • Forums
    • Videos
    • File a Ticket
    • Service Health
    • Blog
    About
    • About
    • Jobs
    • Contact
    • Press Room
    • Privacy Policy
    • Terms of Service
    • Acceptable Use
    • Style Guide
     
     
    Sign Up

    ©2017 PlayFab, Inc.

    ©2016 PlayFab, Inc. All rights reserved. PlayFab® is a registered trademark of PlayFab, Inc. | Privacy | Terms | Acceptable Use
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Post an idea
    • Create an article
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Ideas
    • Articles
    • Users
    • Badges