Clean up duplicated code related to package download requests.