Extensions: Specify JSON in the URL headers

This way the URL can simply be: `https://extesions.blender.org`
Later we will also add the Blender version in the header.

Internally the server will then use this information to point Blender to
the right API entry.

Related:
https://projects.blender.org/infrastructure/extensions-website/pulls/20

Pull Request: https://projects.blender.org/blender/blender-addons-contrib/pulls/24
This commit is contained in:
Dalai Felinto
2024-02-08 11:22:35 +01:00
committed by Gitea
parent 1868f1d92a
commit 759ae5aaa8

View File

@ -489,11 +489,13 @@ def url_retrieve_to_data_iter(
from urllib.error import ContentTooShortError
from urllib.request import urlopen
with contextlib.closing(urlopen(
url,
data,
timeout=timeout_in_seconds,
)) as fp:
headers = {'Accept': 'application/json'}
request = urllib.request.Request(
url,
data=data,
headers=headers)
with contextlib.closing(urlopen(request, timeout=timeout_in_seconds)) as fp:
headers = fp.info()
size = -1