You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by bh...@apache.org on 2022/07/21 15:53:31 UTC

[beam] branch master updated: Add accept-language header for MPL license (#22395)

This is an automated email from the ASF dual-hosted git repository.

bhulette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 86d0564ace0 Add accept-language header for MPL license (#22395)
86d0564ace0 is described below

commit 86d0564ace066917680aef600aeac10c97f6a6d4
Author: Brian Hulette <bh...@google.com>
AuthorDate: Thu Jul 21 08:53:24 2022 -0700

    Add accept-language header for MPL license (#22395)
---
 sdks/java/container/license_scripts/pull_licenses_java.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sdks/java/container/license_scripts/pull_licenses_java.py b/sdks/java/container/license_scripts/pull_licenses_java.py
index cfa23f8f352..f453b6c64bc 100644
--- a/sdks/java/container/license_scripts/pull_licenses_java.py
+++ b/sdks/java/container/license_scripts/pull_licenses_java.py
@@ -55,7 +55,12 @@ def pull_from_url(file_name, url, dep, no_list):
         logging.info('Replaced local file URL with {url} for {dep}'.format(url=url, dep=dep))
 
     try:
-        url_read = urlopen(Request(url, headers={'User-Agent': 'Apache Beam'}))
+        url_read = urlopen(Request(url, headers={
+            'User-Agent': 'Apache Beam',
+            # MPL license fails to resolve redirects without this header
+            # see https://github.com/apache/beam/issues/22394
+            'accept-language': 'en-US,en;q=0.9',
+        }))
         with open(file_name, 'wb') as temp_write:
             shutil.copyfileobj(url_read, temp_write)
         logging.debug(