Last active
November 2, 2017 21:35
-
-
Save sfaleron/5169f5619a2b67a87e40eb5e5da0a809 to your computer and use it in GitHub Desktop.
Check the current version of maven artifacts at jcenter
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
# Query the current version of maven artifacts at jcenter | |
# Current favorites: | |
# | |
# org=org.jetbrains.kotlin pkg=kotlin-runtime | |
# org=io.kotlintest pkg=kotlintest | |
# org=no.tornado pkg=tornadofx | |
import requests | |
url = 'https://api.bintray.com/search/packages/maven' | |
aliases = {'pkg':'a', 'org': 'g'} | |
_defaults = { | |
'repo' : 'jcenter' | |
} | |
def query(**kwargs): | |
kwargs.update(_defaults) | |
for k,v in kwargs.items(): | |
if k in aliases: | |
del kwargs[k] | |
kwargs[aliases[k]]=v | |
req = requests.get(url, params=kwargs) | |
if req.status_code == 200: | |
return req.json()[0]['versions'][0] | |
return '' | |
if __name__ == '__main__': | |
import sys | |
try: | |
ans = query(**dict([i.split('=') for i in sys.argv[1:]])) | |
except: | |
ans = '' | |
print(ans if ans else 'Request failed!') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment