This is python Script that provides an Api for kilimall and Jumia Shopping sites.it helps you to download goods in stock from a jumia or kilimall page when you provide a url to that page.
#Getting Started
Clone the repository from GitHub
$ git clone https://github.com/Keithwachira/ShoppingApi.git
#Prerequisites
You need python 2.6 or a later version to run this script,you also need requests,lxml and BeautifulSoup
installing the prerequisites using pip
$ pip install requests
$ pip install BeautifulSoup
pip install lxml
or installing using easy_install
$ easy_install requests
$ easy_install BeautifulSoup
$ easy_install lxml
#Example
using the jumia Api
import ShoppingApi
url="https://www.jumia.co.ke/smartphones/?page=2"
#downloading all smartphone from second jumia page
try:
jumia_items=ShoppingApi.storeJumia("url")
#loop trough the list returned and store the data
"""to print first item in the shop"""
try:
print jumia_items[0]
except indexError:
print "page has no phones"
for items in jumia_items:
#store items in a database for later use
except AttributeError:
print "No such page found"
using the Kilimall Api
import ShoppingApi
url="https://www.kilimall.co.ke/smartphones/"
#downloading all smartphone from kilimall first page
try:
kilimall_items=ShoppingApi.storeKilimall("url")
#loop trough the list returned and store the data
for items in jumia_items:
#store items in a database for later use
except AttributeError:
print "No such page found"
#Running the Program in terminal
1.Open the terminal and cd into the directory you extracted the project.
2.On the terminal run python ShoppingApi.py and if all your text run you should get output as follows