From 66bcaa782e634a56b6ca3948adb2176404ea19c9 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Sat, 21 Sep 2024 22:18:58 -0400 Subject: [PATCH] Add Accept-Language and Accept-Encoding headers to wrap requests This makes wrap requests look more like browser requests, which is helpful in rare cases to prevent the request from being rejected --- mesonbuild/wrap/wrap.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 3fe40ed9f322..197a4478a40e 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -687,7 +687,11 @@ def get_data(self, urlstring: str) -> T.Tuple[str, str]: elif WHITELIST_SUBDOMAIN in urlstring: raise WrapException(f'{urlstring} may be a WrapDB-impersonating URL') else: - headers = {'User-Agent': f'mesonbuild/{coredata.version}'} + headers = { + 'User-Agent': f'mesonbuild/{coredata.version}', + 'Accept-Language': '*', + 'Accept-Encoding': '*', + } creds = self.get_netrc_credentials(url.netloc) if creds is not None and '@' not in url.netloc: