Emagister API client
Project description
Emagister API client
emagisterapi is a python client to retrieve information from Emagister API.
Table of Contents
Installations
Dependencies
emagisterapi requires:
Installation
You can install emagisterapi using pip
pip install emagisterapi
That easy.
Project Motivation
emagisterapi has been created in order to facilitate access to the Emagister API data
Modules
In this version, emagisterapi has only one module:
connect
The connect
module includes classes to connect and retrieve resources from Emagister API.
The Courses
class:
These are the constructor parameters of the Courses
class:
parameter | type | description | values |
---|---|---|---|
country |
str | Country of the site where the data comes from | es, uk, fr, mx |
version |
str | API version. Default: 1.0 | 1.0 or 2.0 |
page_size |
int | Number of results per page. Default: 25 | >= 1 |
silent |
bool | If it is True , you will see the log printed on screen. Default: False |
True or False |
The Courses
class has one method called get
and these are his parameters:
parameter | type | description | values |
---|---|---|---|
subset |
dict or list | Subset of fields to retrieve. If None , all fields will be retrieved. Default: None |
|
filters |
dict | Dictionary or list of filters to apply. Default: None |
See documentation |
max_records |
int | Maximum number of records to retrieve. If None , all records will be retrieved. Default: None |
>= 1 |
Instructions
To retrieve course from Emagister API, run this code:
from emagapi.connect import Courses
courses_api = Courses(country='uk', page_size=100, silent=False)
subset = {'course_id': 'id',
'title': 'name',
'description': 'description',
'center': 'center_name',
'type': 'type',
'price': 'price',
'start_date': 'start_date',
'flexible_start': 'flexible_start_date'}
courses = courses_api.get(subset, max_records=25000)
# output (if silent == False)
# GET: https://www.emagister.co.uk/api/1.0/courses?page=1&size=100 [200]
# Records: 100/25000
# GET: https://www.emagister.co.uk/api/1.0/courses?page=2&size=100 [200]
# Records: 200/25000
# GET: https://www.emagister.co.uk/api/1.0/courses?page=3&size=100 [200]
# Records: 300/25000
# GET: https://www.emagister.co.uk/api/1.0/courses?page=4&size=100 [200]
# Records: 400/25000
# ...
# GET: https://www.emagister.co.uk/api/1.0/courses?page=249&size=100 [200]
# Records: 24900/25000
# GET: https://www.emagister.co.uk/api/1.0/courses?page=250&size=100 [200]
# Records: 25000/25000
The result is a list of dictionaries whose keys are the values of subset
:
print(courses[0])
# output
# {'course_id': '170648149',
# 'title': 'Advanced Sales Management',
# 'description': 'Discover new tools for turning the art of management into a reliable science. Strengthen...',
# 'center': 'Salessense',
# 'type': 'Course',
# 'price': '£5,995',
# 'start_date': None,
# 'flexible_start': True}
More info
You can read the Emagister API documentation here.
License
Copyright (c) 2019 Cisco Delgado
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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
File details
Details for the file emagisterapi-0.4.2.tar.gz
.
File metadata
- Download URL: emagisterapi-0.4.2.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2aae93d28be961af3350f7f766c3c7131ab81bba92c11030710f284191b6112c |
|
MD5 | ad608ff70bded64d212396151676c04f |
|
BLAKE2b-256 | ac02f6ade057c2f8d07ee562051e4737c42e3d67a1f5b66e2361671047b6182a |
File details
Details for the file emagisterapi-0.4.2-py3-none-any.whl
.
File metadata
- Download URL: emagisterapi-0.4.2-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e463611c800c4fc10bd8f1674dfa870d30d7c5a20a3cde8cc4b6e0bc501e5fd8 |
|
MD5 | 60e18a7dea88517134cf115d6d773aa8 |
|
BLAKE2b-256 | 230bde9d9537702ce0db5941c2dc47d7ce0b75b3dd0286db7ca8abd2980423d6 |