|
1 |
| -***** |
| 1 | +********* |
2 | 2 | Fetchcode
|
3 |
| -***** |
| 3 | +********* |
4 | 4 | It is a library to reliably fetch code via HTTP, FTP and version control systems.
|
5 | 5 |
|
6 | 6 | Installation
|
7 | 7 | ############
|
8 | 8 | Clone the repo using
|
9 |
| -`git clone https://github.com/nexB/fetchcode` |
| 9 | + |
| 10 | +:code:`git clone https://github.com/nexB/fetchcode` |
10 | 11 |
|
11 | 12 | Then install all the requirements using
|
12 |
| -`pip3 install -r requirements.txt` |
| 13 | + |
| 14 | +:code:`pip3 install -r requirements.txt` |
13 | 15 |
|
14 | 16 | Running test suite
|
15 |
| -################# |
| 17 | +################## |
16 | 18 |
|
17 | 19 | To run test suite
|
18 |
| -`python3 -m pytest` |
| 20 | + |
| 21 | +:code:`python3 -m pytest` |
19 | 22 |
|
20 | 23 | Usage of API to fetch HTTP/S and FTP URLs
|
21 | 24 | #########################################
|
22 |
| -``` |
23 |
| -from fetchcode import fetch |
24 |
| -url = 'A Http or FTP URL' |
25 |
| -location = 'Location of file' |
26 |
| -# This returns a response object which has attributes |
27 |
| -# 'content_type' content type of the file |
28 |
| -# 'location' the absolute location of the files that was fetched |
29 |
| -# 'scheme' scheme of the URL |
30 |
| -# 'size' size of the retrieved content in bytes |
31 |
| -# 'url' fetched URL |
32 |
| -resp = fetch(url = url) |
33 |
| -``` |
| 25 | + |
| 26 | +.. code-block:: python |
| 27 | +
|
| 28 | + from fetchcode import fetch |
| 29 | + url = 'A Http or FTP URL' |
| 30 | + # This returns a response object which has attributes |
| 31 | + # 'content_type' content type of the file |
| 32 | + # 'location' the absolute location of the files that was fetched |
| 33 | + # 'scheme' scheme of the URL |
| 34 | + # 'size' size of the retrieved content in bytes |
| 35 | + # 'url' fetched URL |
| 36 | + resp = fetch(url = url) |
0 commit comments