我嘗試通過以編程方式更新應用程序的Firefox Marketplace條目。我能夠成功上傳屏幕截圖,使用模塊marketplace
中的client.create_screenshot(app_id, filename)
方法針對開發環境https://marketplace-dev.allizom.org/。Firefox Marketplace API:應用圖標在成功上傳後保持默認狀態
在Python API中沒有上傳圖標的方法。在市場API文檔不過,有一個REST點上傳圖標:Updating an App Icon
我使用的文檔寫我自己的方法來上傳圖標:
import mimetypes
import sys
from base64 import b64encode
from urlparse import urlunparse
def post_icon_file(client, app_id, filename):
with open(filename, 'rb') as s_file:
s_content = s_file.read()
s_encoded = b64encode(s_content)
url = urlunparse((client.protocol, '%s:%s' % (client.domain, client.port),
'%s/api/v2%s' % (client.prefix, '/apps/app/' + str(app_id) + '/icon/'),
'', '', ''))
print url
mtype, encoding = mimetypes.guess_type(filename)
if mtype is None:
mtype = 'image/jpeg'
data = {'file': {
'type': mtype,
'data': s_encoded
}}
response = client.conn.fetch('PUT', url, data)
if response.status_code != 200:
sys.exit(response.content)
else:
print str(response.status_code) + ': Uploaded icon ' + filename + ' for app ID ' + str(app_id)
問題:的上傳的響應是成功的(200)。我得到的消息:
200:上傳圖標在https://marketplace-dev.allizom.org/developers/app/[slug]/edit賣場入口/path/to/icon/icon-512.png的應用程序ID 1234567
儘管如此,應用程序圖標顯示作爲默認的圖標
我的調查至今:
如果我得到一個狀態pp via
client.status(app_id)
圖標的條目仍然是默認的,例如:圖標:{u \'128 \':u \'https://marketplace-dev-cdn.allizom.org/media/img/hub/default-128.png \'我試圖上傳一個大小爲128的圖標128像素和另一個512乘512像素。兩者都有相同的結果:成功,但它們在條目中沒有改變。
你的意思是我應該叉贊博尼,看看我可以在我的克隆中重現Bug嗎? – Rias 2015-04-07 12:11:39
我meam叉Zamboni並嘗試修復這個錯誤。 或者僅在bugzilla中提交錯誤。 – 2015-04-08 01:06:43
感謝alexandersalas。我無法在本地機器上重現Zamboni中的錯誤。但是我在這裏提交了一個bug並進行了適當的評論:https://bugzilla.mozilla.org/show_bug.cgi?id=1153669 – Rias 2015-04-14 11:37:00