fetchcode is a library to reliably fetch code via HTTP, FTP and version control systems.
Project description
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: https://github.com/nexB/fetchcode
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 https://github.com/nexB/fetchcode
Then install all the requirements using:
configure --dev
Running tests
To run test suite use:
pytest -vvs
Usage
Fetch a code archive and get a fetchcode.fetch.Response object back:
>>> from fetchcode import fetch >>> f = fetch('https://github.com/nexB/fetchcode/archive/ab65b2e645c889887227ea49eb3332d885fd0a54.zip') >>> f.location '/tmp/tmp_cm02xsg' >>> f.content_type 'application/zip' >>> f.url 'https://github.com/nexB/fetchcode/archive/ab65b2e645c889887227ea49eb3332d885fd0a54.zip'
Fetch some package metadata and get a fetchcode.packagedcode_models.Package object back:
>>> from fetchcode import package >>> list(package.info('pkg:rubygems/files')) [Package(type='rubygems', namespace=None, name='files', version=None)]
License
SPDX-License-Identifier: Apache-2.0
Copyright (c) nexB Inc. and others.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for fetchcode-0.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f82bf2fb4e41683ddccf8d9da27a0950574e9bbc8c2d8e81b0e1bf52864ba40 |
|
MD5 | df6672feca5d51f8baf55c1e283d394d |
|
BLAKE2b-256 | 8147ca4fce191882eda5c073bdf6b1e757c893183d9824a33e54e8ff5f53dedf |