Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

Conflicts:
	python/lib/marketplace.py
  • Loading branch information...
commit b6f0bbc5832f9bc0bd9aa7aa105dd6ec764e96f6 2 parents 095f5af + b6ce526
@zalun zalun authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 python/lib/marketplace.py
View
10 python/lib/marketplace.py
@@ -9,6 +9,7 @@
import logging
import time
import urllib
+import mimetypes
from base64 import b64encode
@@ -67,7 +68,7 @@ def url(self, key):
"""Creates a full URL to the API using urls dict
"""
return urlunparse((self.protocol, '%s:%s' % (self.domain, self.port),
- '%s/en-US/api%s' % (self.prefix, urls[key]),
+ '%s/api%s' % (self.prefix, urls[key]),
'', '', ''))
def set_consumer(self, consumer_key, consumer_secret):
@@ -241,8 +242,13 @@ def create_screenshot(self, app_id, filename, mimetype='image/jpg',
s_content = s_file.read()
s_encoded = b64encode(s_content)
url = self.url('create_screenshot') % app_id
+
+ mtype, encoding = mimetypes.guess_type(filename)
+ if mtype is None:
+ mtype = 'image/jpeg'
+
data = {'position': position,
- 'file': {'type': mimetype,
+ 'file': {'type': mtype,
'data': s_encoded}}
return self.post(url, data)
Please sign in to comment.
Something went wrong with that request. Please try again.