![Firefox 构建“--with-bing-api-keyfile”的正确格式是什么?](https://linux22.com/image/1531011/Firefox%20%E6%9E%84%E5%BB%BA%E2%80%9C--with-bing-api-keyfile%E2%80%9D%E7%9A%84%E6%AD%A3%E7%A1%AE%E6%A0%BC%E5%BC%8F%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%9F.png)
我尝试通过指定 bing API 密钥(ac_add_options --with-bing-api-keyfile=</path/to/keyfile>
在 中.mozconfig
)来构建 Firefox。但是,当配置运行时,我收到错误,ERROR: Bing API key file has an invalid format.
我在文件中以 64 个字符的字符串形式提供了 API </path/to/keyfile>
(带或不带尾随换行符,两者都不起作用)。
答案1
答案是:
API 密钥所属的用户名需要添加到前面,并以空格分隔。因此格式应为
<https://www.bingmapsportal.com/-Username> <API key>
看看检查 Firefox 构建配置的 Python 脚本表明需要一些信息,例如身份证号:
[...]
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, {})
[...]