File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 55``` bash
66python3 -m pip install --user dephell_changelogs
77```
8+
9+ ## Usage
10+
11+ Get changelog url:
12+
13+ ``` python
14+ from dephell_changelogs import get_changelog_url
15+
16+ url = get_changelog_url(' dephell' )
17+ url = get_changelog_url(' https://dephell.readthedocs.io/' )
18+ url = get_changelog_url(' https://github.com/dephell/dephell/' )
19+ ```
20+
21+ Parse changelog:
22+
23+ ``` python
24+ from dephell_changelogs import parse_changelog
25+
26+ parsed = parse_changelog(url)
27+ parsed[' 0.8.0' ]
28+ # 'New commands:\n\n+ [dephell package bug]...'
29+ ```
Original file line number Diff line number Diff line change 22import re
33from typing import Dict , Optional
44
5+ # external
6+ import requests
7+
58
69rex_version = re .compile (r'[0-9]+\.[0-9]+\.[0-9]+' )
710
@@ -47,8 +50,12 @@ def _get_version(line: str) -> Optional[str]:
4750
4851
4952def parse_changelog (content : str ) -> Dict [str , str ]:
50- changelog = dict ()
53+ if content .startswith ('https://' ) and len (content .split ()) == 1 :
54+ response = requests .get (url = content )
55+ response .raise_for_status ()
56+ content = response .text
5157
58+ changelog = dict ()
5259 version = None
5360 notes = []
5461 for line in content .splitlines ():
You can’t perform that action at this time.
0 commit comments