Last active
January 20, 2017 17:28
-
-
Save subuk/202f3100ec661a100232686a5cc50f77 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import requests | |
from requests.auth import HTTPBasicAuth | |
URL_TEMPLATE = ( | |
"https://api.bintray.com" | |
"/packages/{subject}/{repo}/{package}/files" | |
) | |
packages = ["main", "atlassian", "backend"] | |
URL_DATA = { | |
"subject": "COMPANY", | |
"repo": "REPO", | |
"package": "PACKAGE", | |
"version": "VERSOIN", | |
} | |
auth = HTTPBasicAuth("username", "api-key") | |
for package in packages: | |
URL_DATA['package'] = package | |
url = URL_TEMPLATE.format(**URL_DATA) | |
response = requests.get(url, auth=auth) | |
response.raise_for_status() | |
for fileinfo in response.json(): | |
print "https://username:[email protected]/repo/{path}".format(**fileinfo) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
urls=$(cat urls.list) | |
pushd ~/workspace/repo | |
for url in $urls;do | |
path=$(echo $url|awk -F'https://username:[email protected]/' '{print $2}') | |
mkdir -p $(dirname $path) | |
pushd $(dirname $path) | |
wget $url | |
popd | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment