Skip to content

Commit a6daa58

Browse files
authored
Merge pull request #46 from bsolomon1124/readme-touchups
Touch up README.md
2 parents 21ed2b8 + f85156d commit a6daa58

2 files changed

Lines changed: 40 additions & 19 deletions

File tree

LICENSE.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 Matt Lisivick
3+
Copyright (c) 2018-2019 Matt Lisivick
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

README.md

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,42 @@
11
# newsapi-python
2-
A Python client for the [News API](https://newsapi.org/docs/)
32

4-
[![PyPI version](https://badge.fury.io/py/newsapi-python.svg)](https://badge.fury.io/py/newsapi-python)
3+
A Python client for the [News API](https://newsapi.org/docs/).
54

6-
##### Provided under MIT License by Matt Lisivick.
7-
*Note: this library may be subtly broken or buggy. The code is released under
8-
the MIT License – please take the following message to heart:*
9-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5+
[![License](https://img.shields.io/github/license/mattlisiv/newsapi-python.svg)](https://github.com/mattlisiv/newsapi-python/blob/master/LICENSE.txt)
6+
[![PyPI](https://img.shields.io/pypi/v/newsapi-python.svg)](https://pypi.org/project/newsapi-python/)
7+
[![Status](https://img.shields.io/pypi/status/newsapi-python.svg)](https://pypi.org/project/newsapi-python/)
8+
[![Python](https://img.shields.io/pypi/pyversions/newsapi-python.svg)](https://pypi.org/project/newsapi-python)
9+
10+
## License
11+
12+
Provided under [MIT License](https://github.com/mattlisiv/newsapi-python/blob/master/LICENSE.txt) by Matt Lisivick.
13+
14+
```
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1016
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1117
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1218
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1319
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1420
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
```
1522

16-
## General
17-
18-
This is a Python client library for News API V2. The functions for the library should mirror the
19-
endpoints from the [documentation](https://newsapi.org/docs/endpoints).
23+
## General
2024

25+
This is a Python client library for [News API V2](https://newsapi.org/).
26+
The functions and methods for this library should mirror the
27+
endpoints specified by the News API [documentation](https://newsapi.org/docs/endpoints).
2128

2229
## Installation
23-
Installation for the package can be done via pip.
2430

25-
```commandline
26-
pip install newsapi-python
31+
Installation for the package can be done via `pip`:
32+
33+
```bash
34+
$ python -m pip install newsapi-python
2735
```
2836

2937
## Usage
3038

31-
After installation, import client into your project:
39+
After installation, import the client class into your project:
3240

3341
```python
3442
from newsapi import NewsApiClient
@@ -41,19 +49,29 @@ api = NewsApiClient(api_key='XXXXXXXXXXXXXXXXXXXXXXX')
4149
```
4250

4351
### Endpoints
44-
52+
53+
An instance of `NewsApiClient` has three instance methods corresponding to three News API endpoints.
54+
4555
#### Top Headlines
4656

57+
Use `.get_top_headlines()` to pull from the [`/top-headlines`](https://newsapi.org/docs/endpoints/top-headlines) endpoint:
58+
4759
```python
4860
api.get_top_headlines(sources='bbc-news')
4961
```
62+
5063
#### Everything
5164

65+
Use `.get_everything()` to pull from the [`/everything`](https://newsapi.org/docs/endpoints/everything) endpoint:
66+
5267
```python
5368
api.get_everything(q='bitcoin')
5469
```
70+
5571
#### Sources
5672

73+
Use `.get_sources()` to pull from the [`/sources`](https://newsapi.org/docs/endpoints/sources) endpoint:
74+
5775
```python
5876
api.get_sources()
5977
```
@@ -64,7 +82,10 @@ You will encounter an error if you attempt to print the .json() object to the co
6482
This becomes especially annoying if developers wish to get 'under the hood'.
6583

6684
Here is the error:
67-
UnicodeEncodeError: 'charmap' codec can't encode character '\u2019' in position 1444: character maps to <undefined>
85+
86+
```
87+
UnicodeEncodeError: 'charmap' codec can't encode character '\u2019' in position 1444: character maps to <undefined>
88+
```
6889

6990
This can be fixed by:
7091
- installing 'win-unicode-console'
@@ -73,7 +94,7 @@ This can be fixed by:
7394
`py -mrun myPythonScript.py`
7495

7596
Another option is hardcoding your console to only print in utf-8. This is a bad idea, as it could ruin many other scripts and/or make errors MUCH more difficult to track.
76-
[More information](https://stackoverflow.com/questions/5419/python-unicode-and-the-windows-console/32176732#32176732
97+
[More information](https://stackoverflow.com/questions/5419/python-unicode-and-the-windows-console/32176732#32176732).
7798

7899

79100
## Support

0 commit comments

Comments
 (0)