Last active
September 11, 2019 15:30
-
-
Save Rizwan-Hasan/7f314de3d3f25dda074d9387620d1ae5 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
import requests | |
def main(): | |
userName: str = 'magpie-robins' # User name of the repository | |
repoName: str = 'gpa-calculator-android' # Repository name | |
releaseTag: str = 'latest' # Using tag 'latest' for latest released download count | |
url: str = "https://api.github.com/repos/{0}/{1}/releases/{2}" # API URL | |
response = requests.get(url.format(userName, repoName, releaseTag)) # Sending HTTP GET request on API URL | |
data: dict = response.json() # Converting received data to JSON format | |
# The JSON file contains huge data about that release. | |
data = data['assets'][0]["download_count"] # Extracting required data from JSON | |
print("Total download: %d" % data) # Printing count | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment