Skip to main content

Build CodeRate pypi

python-smartprice

A simple scraping-based python library for MySmartPrice - price comparison site.

Introduction

MySmartPrice is a platform which provided best seller price across a wide array of categories that include Mobiles, Electronics, Computers, Fashion and Lifestyle, Cameras, Books, Appliances and Personal Care.

Installation

pip install python-smartprice

Prerequisites

  • Requests

  • BeautifulSoup 4

  • Python 2.7+

Quickstart

GET PRICE LIST

Check all the below Supported attributes.

>>> from pysmartprice.base import SmartPrice
>>> smartprice = SmartPrice()

>>> len(smartprice.samsung_mobiles)
Out[5]: 142

>>> smartprice.samsung_mobiles
Out[6]: [<pysmartprice.results.SmartPriceResult at 0x10df46f90>,
 <pysmartprice.results.SmartPriceResult at 0x10df46fd0>,
 <pysmartprice.results.SmartPriceResult at 0x10df50050>,
 <pysmartprice.results.SmartPriceResult at 0x10df50090>,
 <pysmartprice.results.SmartPriceResult at 0x10df500d0>,
 <pysmartprice.results.SmartPriceResult at 0x10df50110>,
 <pysmartprice.results.SmartPriceResult at 0x10df50150>,
 <pysmartprice.results.SmartPriceResult at 0x10df50190>]

>>> samsung_mobile = smartprice.samsung_mobiles[0]

>>> samsung_mobile.title
Out[7]: u'Samsung Galaxy J7'

>>> samsung_mobile.best_price
Out[8]: '14,299'

>>> samsung_mobile.dumptojson
Out[9]:
  {u'best_price': u'14,664',
   u'img': u'http://c0028545.cdn1.cloudfiles.rackspacecloud.com/7178-7-thumb.jpg',
   u'product_id': u'7178',
   u'title': u'\nSamsung Galaxy J7\n',
   u'url': u'http://www.mysmartprice.com/mobile/samsung-galaxy-j7-msp7178'}

SEARCH PRICE LIST

>>> from pysmartprice.base import SmartPrice
>>> smartprice = SmartPrice()

>>> smartprice.search('SAMSUNG')
Out[4]: [<pysmartprice.results.SmartPriceResult at 0x102b05990>,
<pysmartprice.results.SmartPriceResult at 0x100d36850>,
<pysmartprice.results.SmartPriceResult at 0x1024129d0>,
<pysmartprice.results.SmartPriceResult at 0x102412b10>,
<pysmartprice.results.SmartPriceResult at 0x102412f90>,
<pysmartprice.results.SmartPriceResult at 0x102412fd0>,
<pysmartprice.results.SmartPriceResult at 0x102412e10>,
<pysmartprice.results.SmartPriceResult at 0x102412d50>,
<pysmartprice.results.SmartPriceResult at 0x102412c50>,
...]

In [3]: len(s.search('SAMSUNG'))
Out[3]: 1012

In [3]: results = s.search('SAMSUNG')

In [4]: results[0].dumptojson
Out[4]:
  {u'best_price': u'14,664',
   u'img': u'http://c0028545.cdn1.cloudfiles.rackspacecloud.com/7178-7-thumb.jpg',
   u'product_id': u'7178',
   u'title': u'\nSamsung Galaxy J7\n',
   u'url': u'http://www.mysmartprice.com/mobile/samsung-galaxy-j7-msp7178'}

GET SELLERS DETAILS

>> from pysmartprice.base import SmartPrice
>> smartprice = SmartPrice()

>> results = smartprice.sellers('Samsung Galaxy J2')
>> results
Out[4]: [<pysmartprice.results.SmartPriceResult at 0x109eca590>]

In [5]: results[0].dumptojson
Out[5]:
  {'best_price': '8,199',
   'img': 'http://c0028545.cdn1.cloudfiles.rackspacecloud.com/7448-6-thumb.jpg',
   'product_id': '7448',
   'title': 'Samsung Galaxy J2',
   'sellers': [
      {'logo': u'http://c223968.r68.cf1.rackcdn.com/syberplace_store.png',
       'name': u'Seller:\nSyberplace',
       'price': u'8,199',
       'rating': u'5/5'},
      {'logo': u'http://c223968.r68.cf1.rackcdn.com/amazon_store.png',
       'name': u'Seller:Amazon Seller',
       'price': u'8,330',
       'rating': u'4.5/5'},
      {'logo': u'http://c223968.r68.cf1.rackcdn.com/ebay_store.png',
       'name': u'Seller:Bberry.stores',
       'price': u'8,215',
       'rating': u'5/5'},
      {'logo': u'http://c223968.r68.cf1.rackcdn.com/paytm_store.png',
       'name': u'Seller:RYAISHA RETAILS PVT LTD',
       'price': u'8,496',
       'rating': u'3.2/5'},
      {'logo': u'http://c223968.r68.cf1.rackcdn.com/indiatimes_store.png',
       'name': u'Seller:Indiatimes',
       'price': u'8,314',
       'rating': u'2.5/5'},
      {'logo': u'http://c223968.r68.cf1.rackcdn.com/flipkart_store.png',
       'name': u'Seller:WS Retail',
       'price': u'8,499',
       'rating': u'4.2/5'}],
  'url': 'http://www.mysmartprice.com/mobile/samsung-galaxy-j2-msp7448'}

Supported attributes

Get the best prices for the below attributes

  • mobiles

  • samsung_mobiles

  • nokia_mobiles

  • micromax_mobiles

  • iphones

  • htc_mobiles

  • tablets

  • samsung_tablets

  • lenovo_tablets

  • micromax_tablets

  • apple_ipads

  • laptops

  • hp_laptops

  • dell_laptops

  • lenovo_laptops

  • sony_laptops

  • toshiba_laptops

  • macbooks

  • samsung_laptops

  • tvs

  • samsung_tvs

  • sony_tvs

  • lg_tvs

  • panasonic_tvs

  • sharp_tvs

Metadata

Release files for python-smartprice 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-smartprice 0.0.3
File Size Uploaded
python-smartprice-0.0.3.tar.gz 9.6 kB Details

Release files / python-smartprice-0.0.3.tar.gz

Download URL python-smartprice-0.0.3.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
935a74b17d4fea05bde81c60da76dc3bb30240f0597d83e3e97e8285dab0eafa
BLAKE2b-256 checksum
How to use checksums
dae78db6458d19e9988cbf5584c956a43d971fe412e8eb3c6588b5bf933f57c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.3 This release

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page