Created
September 28, 2020 22:36
-
-
Save ri5h/b782298b1375dc4262351f4df27541fd to your computer and use it in GitHub Desktop.
Read package info from packagist
This file contains 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
# Read the latest version available from packagist | |
finalRes = [] | |
for package in reqPack: | |
finalPackageResult = { | |
'name': package | |
} | |
# Try to get info from packagist (works with or w/o repo) | |
url = 'https://repo.packagist.org/packages/' + package + '.json' | |
jsonMetaRes = requests.get(url) | |
if jsonMetaRes.status_code != 200: | |
finalPackageResult['msg'] = 'packagist error for url: ' + url | |
finalPackageResult['status'] = 'failed' | |
finalRes.append(finalPackageResult) | |
continue | |
jsonMeta = jsonMetaRes.json()['package'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment