Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'master' of github.com:mozilla/MarketplaceClientExample

Conflicts:
	python/lib/marketplace.py
  • Loading branch information...
commit b6f0bbc5832f9bc0bd9aa7aa105dd6ec764e96f6 2 parents 095f5af + b6ce526
Piotr Zalewa authored

Showing 1 changed file with 8 additions and 2 deletions. Show diff stats Hide diff stats

  1. +8 2 python/lib/marketplace.py
10 python/lib/marketplace.py
@@ -9,6 +9,7 @@
9 9 import logging
10 10 import time
11 11 import urllib
  12 +import mimetypes
12 13
13 14 from base64 import b64encode
14 15
@@ -67,7 +68,7 @@ def url(self, key):
67 68 """Creates a full URL to the API using urls dict
68 69 """
69 70 return urlunparse((self.protocol, '%s:%s' % (self.domain, self.port),
70   - '%s/en-US/api%s' % (self.prefix, urls[key]),
  71 + '%s/api%s' % (self.prefix, urls[key]),
71 72 '', '', ''))
72 73
73 74 def set_consumer(self, consumer_key, consumer_secret):
@@ -241,8 +242,13 @@ def create_screenshot(self, app_id, filename, mimetype='image/jpg',
241 242 s_content = s_file.read()
242 243 s_encoded = b64encode(s_content)
243 244 url = self.url('create_screenshot') % app_id
  245 +
  246 + mtype, encoding = mimetypes.guess_type(filename)
  247 + if mtype is None:
  248 + mtype = 'image/jpeg'
  249 +
244 250 data = {'position': position,
245   - 'file': {'type': mimetype,
  251 + 'file': {'type': mtype,
246 252 'data': s_encoded}}
247 253 return self.post(url, data)
248 254

0 comments on commit b6f0bbc

Please sign in to comment.
Something went wrong with that request. Please try again.