Skip to content

Instantly share code, notes, and snippets.

@stanley-shi
Last active April 12, 2017 17:10
Show Gist options
  • Save stanley-shi/0d99edfb034c6fe178ec to your computer and use it in GitHub Desktop.
Save stanley-shi/0d99edfb034c6fe178ec to your computer and use it in GitHub Desktop.
How to get the preferred download address for an apache component
# this script prints the preferred apache mirror and path_info to download components;
import urllib
import json
url="https://www.apache.org/dyn/closer.cgi?as_json=1"
#url='https://www.apache.org/dyn/closer.cgi/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz?as_json=1'
result=json.load(urllib.urlopen(url))
print result['preferred']
print result['path_info']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment