Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
{"category": "3.3", "downloads": 414},
{"category": "3.4", "downloads": 62166},
{"category": "3.5", "downloads": 79425},
{"category": "3.6", "downloads": 112266},
{"category": "3.7", "downloads": 25961},
{"category": "3.8", "downloads": 58},
{"category": "null", "downloads": 7122}
],
"package": "pip",
"type": "python_minor_downloads"
}"""
# Act
with requests_mock.Mocker() as m:
m.get(mocked_url, text=mocked_response)
output = pypistats.python_minor(package, format="json")
# Assert
self.assertEqual(json.loads(output), json.loads(expected_output))
}"""
expected_output = """{
"data": [
{"category": "2.6", "date": "2018-11", "downloads": 3},
{"category": "2.6", "date": "2018-12", "downloads": 7},
{"category": "2.7", "date": "2018-11", "downloads": 30},
{"category": "2.7", "date": "2018-12", "downloads": 70}
],
"package": "pip",
"type": "python_minor_downloads"
}"""
# Act
with requests_mock.Mocker() as m:
m.get(mocked_url, text=mocked_response)
output = pypistats.python_minor(package, total="monthly", format="json")
# Assert
self.assertEqual(json.loads(output), json.loads(expected_output))
def python_minor(args): # pragma: no cover
print(
pypistats.python_minor(
args.package,
version=args.version,
start_date=args.start_date,
end_date=args.end_date,
format=args.format,
total="daily" if args.daily else ("monthly" if args.monthly else "all"),
verbose=args.verbose,
)