Skip to content

Commit

Permalink
documentation: change README.rst in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
SteinRobert committed Apr 2, 2021
1 parent 715f7e0 commit 88c4c97
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 32 deletions.
58 changes: 27 additions & 31 deletions README.rst → README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,45 @@
=====================
python-restcountries
=====================
====================
------
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Coverage Status](https://coveralls.io/repos/github/SteinRobert/python-restcountries/badge.svg?branch=master)](https://coveralls.io/github/SteinRobert/python-restcountries?branch=master)

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/SteinRobert/python-restcountries

.. image:: https://coveralls.io/repos/github/SteinRobert/python-restcountries/badge.svg?branch=master
:target: https://coveralls.io/github/SteinRobert/python-restcountries?branch=master


This is a simple python wrapper for the API of `http://restcountries.eu <http://restcountries.eu>`.
This is a simple python wrapper for the API of [http://restcountries.eu](http://restcountries.eu).
If there are any issues, please use this repository to contact me about it.

Installation
------------

pip install python-restcountries

```shell
pip install python-restcountries
```


Usage
-----
Just import the API Wrapper and start using it!::
```python
# v1 from restcountries import RestCountryApi as rapi
from restcountries import RestCountryApiV2 as rapi

# v1 from restcountries import RestCountryApi as rapi
from restcountries import RestCountryApiV2 as rapi

def foo(name):
country_list = rapi.get_countries_by_name('France')

def foo(name):
country_list = rapi.get_countries_by_name('France')
```



Response filtering
------------------
Pass filters as a keyword argument to any of RestCountryApiV2 or RestCountryApi methods,
this filters the response returned by the api. Thus the Country Object will only contain the attributes in the
filters list.::

# v1 from restcountries import RestCountryApi as rapi
from restcountries import RestCountryApiV2 as rapi

def foo(name):
country_list = rapi.get_countries_by_name('France',filters=["name","currencies","capital"])
filters list.
```python
# v1 from restcountries import RestCountryApi as rapi
from restcountries import RestCountryApiV2 as rapi

def foo(name):
country_list = rapi.get_countries_by_name("France" ,filters=["name","currencies","capital"])
```


Attributes that can be passed in the filters list.
Expand Down Expand Up @@ -79,12 +75,12 @@ Attributes that can be passed in the filters list.
The Country object
------------------
The API returns Country objects or a list of Country objects. Through the country objects one is able to
access following attributes.::

country = country_list[0]
print(country.name)
France

access following attributes.
```python
country = country_list[0]
print(country.name)
France
```
- top_level_domain
- alpha2_code
- alpha3_code
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
license="Unlicense",
keywords=["api", "wrapper", "country", "countries"],
install_requires=["requests"],
long_description=open("README.rst").read(),
long_description=open("README.md").read(),
classifiers=["Programming Language :: Python :: 3 :: Only"],
)

0 comments on commit 88c4c97

Please sign in to comment.