Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time
May 10, 2022 15:10
May 9, 2022 13:03
August 2, 2021 09:14
September 14, 2022 18:10
May 10, 2022 15:15
January 14, 2021 17:15
September 15, 2022 16:44
February 9, 2022 15:51
May 10, 2022 15:15
March 18, 2021 13:06

FetchCode: Utilities to fetch code from purls, URLs and version control repos.

FetchCode is a library to reliably fetch code via HTTP, FTP and version control systems. It can work using plain HTTP and FTP URLs, as well as Package URLs and version control (VCS) URLs as used in Python pip and as specified in SPDX Package Download Location

Homepage and support:

Why FetchCode?

It is surprisingly difficult to have a simple API to consistently fetch code from package repositories, version control repositories and APIs: each site and each package manager has its own unique and peculiar ways. FetchCode goal is to abstract all these details and make it easy to fetch things reliably.

Development installation

Clone the repo:

git clone

Then install all the requirements using:

configure --dev

Running tests

To run test suite use:

pytest -vvs


Fetch a code archive and get a fetchcode.fetch.Response object back:

>>> from fetchcode import fetch
>>> f = fetch('')
>>> f.location
>>> f.content_type
>>> f.url

Fetch some package metadata and get a fetchcode.packagedcode_models.Package object back:

>>> from fetchcode import package
>>> list('pkg:rubygems/files'))
[Package(type='rubygems', namespace=None, name='files', version=None)]


  • SPDX-License-Identifier: Apache-2.0

Copyright (c) nexB Inc. and others.


A library to reliably fetch code via HTTP, FTP and version control systems. This project is sponsored by NLnet project Google Summer of Code, nexB and others generous sponsors!






No packages published