
我嘗試透過指定 bing API 金鑰(ac_add_options --with-bing-api-keyfile=</path/to/keyfile>
在 中.mozconfig
)來建立 Firefox。但是,當配置運行時,我收到錯誤,ERROR: Bing API key file has an invalid format.
我在文件中將 API</path/to/keyfile>
作為 64 個字元的字串提供(帶或不帶尾隨換行符,兩者都不起作用)。
答案1
答案是:
API 金鑰所屬的使用者名稱需要放在前面,並以空格分隔。所以格式應該是
<https://www.bingmapsportal.com/-Username> <API key>
看著檢查 firefox-build-configuration 的 python 腳本表明需要一些信息,例如 ID:
[...]
with MockedOpen({'key': 'fake-id fake-key\n'}):
config, output, status = self.get_result(
"id_and_secret_keyfile('Bing API')",
args=['--with-bing-api-keyfile=key'],
includes=includes)
self.assertEqual(status, 0)
self.assertEqual(output, textwrap.dedent('''\
checking for the Bing API key... yes
'''))
self.assertEqual(config, {
'MOZ_BING_API_CLIENTID': 'fake-id',
'MOZ_BING_API_KEY': 'fake-key',
})
with MockedOpen({'key': 'fake-key\n'}):
config, output, status = self.get_result(
"id_and_secret_keyfile('Bing API')",
args=['--with-bing-api-keyfile=key'],
includes=includes)
self.assertEqual(status, 1)
self.assertEqual(output, textwrap.dedent('''\
checking for the Bing API key... no
ERROR: Bing API key file has an invalid format.
'''))
self.assertEqual(config, {})
[...]