Skip to content

Commit

Permalink
Add accept-language header for MPL license (#22395)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNeuralBit authored Jul 21, 2022
1 parent 50346b5 commit 86d0564
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sdks/java/container/license_scripts/pull_licenses_java.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 86d0564

Please sign in to comment.