GithubHelp home page GithubHelp logo

stevensherah / shoppingapi Goto Github PK

View Code? Open in Web Editor NEW
3.0 0.0 3.0 101 KB

A repo for jumia and kilimall Api.It helps you download all items in a jumia or kilimall page when you provide the url

Python 100.00%

shoppingapi's Introduction

ShoppingApi

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
Alt text

shoppingapi's People

Contributors

keithwachira avatar

Stargazers

Erfan.Ebrahimi avatar Leakey Njeru avatar Brian Mwangi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.