
Eu tento construir o Firefox especificando uma chave de API do Bing ( ac_add_options --with-bing-api-keyfile=</path/to/keyfile>
no arquivo .mozconfig
). No entanto, quando a configuração é executada, recebo o erro ERROR: Bing API key file has an invalid format.
Forneci a API no arquivo </path/to/keyfile>
como uma sequência de 64 caracteres (com ou sem uma nova linha à direita, ambos não funcionam).
Responder1
A resposta é:
O nome de usuário ao qual pertence a chave API precisa ser anexado, separado por espaço em branco. Então o formato deve ser
<https://www.bingmapsportal.com/-Username> <API key>
Olhando para oscript python que verifica a configuração do firefox-buildsugere que há algumas informações necessárias, como um 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, {})
[...]