| Line 5... |
Line 5... |
| 5 |
'''
|
5 |
'''
|
| 6 |
|
6 |
|
| 7 |
from elixir import *
|
7 |
from elixir import *
|
| 8 |
from datastore.DataCodeDefinition import *
|
8 |
from datastore.DataCodeDefinition import *
|
| 9 |
|
9 |
|
| - |
|
10 |
key_dict = {'INFIBEAM_DOMAINNAME' : "infibeam",
|
| - |
|
11 |
'INFIBEAM_URL' : "http://www.infibeam.com/Mobiles/search?page=",
|
| - |
|
12 |
'INFIBEAM_HOMEPAGE' : "www.infibeam.com",
|
| - |
|
13 |
'INFIBEAM_REFERER' : "www.google.com/search",
|
| - |
|
14 |
'INFIBEAM_VATPLUSTAX' : 0,
|
| - |
|
15 |
'INFIBEAM_REMOVELIST' : ["Rs.",",","-","/","Rs"],
|
| - |
|
16 |
'INFIBEAM_XPATH1' : '//ul[@class="srch_result portrait"]/li',
|
| - |
|
17 |
'INFIBEAM_XPATH2' : './/p/span[@class="title"]/text()',
|
| - |
|
18 |
'INFIBEAM_XPATH3' : './/p/span[@class="price"]/text()',
|
| - |
|
19 |
'INDIAPLAZA_DOMAINNAME' : "indiaplaza",
|
| - |
|
20 |
'INDIAPLAZA_URL' : "http://www.indiaplaza.in/mobile-phones-Mobiles-1.htm?PageNo=",
|
| - |
|
21 |
'INDIAPLAZA_HOMEPAGE' : "www.indiaplaza.com",
|
| - |
|
22 |
'INDIAPLAZA_REFERER' : "www.google.com/search",
|
| - |
|
23 |
'INDIAPLAZA_URL1' : "http://www.indiaplaza.in",
|
| - |
|
24 |
'INDIAPLAZA_XPATH1' : '//tr/td/table[@id="browsesku"]',
|
| - |
|
25 |
'INDIAPLAZA_XPATH2' : './/div[@class="skuimg"]/a/@title',
|
| - |
|
26 |
'INDIAPLAZA_XPATH3' : './/div[@class="skuimg"]/a/@href',
|
| - |
|
27 |
'INDIAPLAZA_DOMAINNAME1' : "indiaplaza1",
|
| - |
|
28 |
'INDIAPLAZA_REMOVELIST' : ["Rs.","Rs",",","-","/"],
|
| - |
|
29 |
'INDIAPLAZA_XPATH4' : './/div[@class="finDetHdr"]/h1/text()',
|
| - |
|
30 |
'INDIAPLAZA_XPATH5' : './/div[@class="priceArea"]/span[1]/text()',
|
| - |
|
31 |
'INDIAPLAZA_XPATH6' : './/div[@class="priceArea"]/div[@class="row"][2]/text()',
|
| - |
|
32 |
'INDIAPLAZA_XPATH7' : './/div[@class="priceArea"]/div[@class="row"][2]/span/text()',
|
| - |
|
33 |
'INDIAPLAZA_XPATH8' : './/div[@class="priceArea"]/div[@class="row"][3]/text()',
|
| - |
|
34 |
'INDIAPLAZA_XPATH9' : './/div[@class="priceArea"]/div[@class="row"][4]/text()',
|
| - |
|
35 |
'INDIAPLAZA_XPATH10' : './/div[@class="priceArea"]/div[@class="row"][1]/text()',
|
| - |
|
36 |
'INDIAPLAZA_VAR1' : "Free shipping",
|
| - |
|
37 |
'MOBILESTORE_DOMAINNAME0' : "mobilestore0",
|
| - |
|
38 |
'MOBILESTORE_URL1' : "http://www.themobilestore.in/mobilestore/faces/tiles/product.jsp?productID=" ,
|
| - |
|
39 |
'MOBILESTORE_URL2' : "&catalogueID=3",
|
| - |
|
40 |
'MOBILESTORE_HOMEPAGE' : "www.themobilestore.in",
|
| - |
|
41 |
'MOBILESTORE_REFERER' : "www.google.com/search",
|
| - |
|
42 |
'MOBILESTORE_XPATH3' : '//span[@id="productLayoutForm:categoryNavigation:navigationList_2:navigationList3"]/text()',
|
| - |
|
43 |
'MOBILESTORE_XPATH4' : '//div[@id="priceComp"]//tr[2]/td[3]/span/text()',
|
| - |
|
44 |
'MOBILESTORE_XPATH5' : '//span[@id="productLayoutForm:categoryNavigation:navigationList_1:navigationList3"]/text()',
|
| - |
|
45 |
'MOBILESTORE_XPATH6' : '//span[@id="productLayoutForm:categoryNavigation:navigationList_0:navigationList3"]/text()',
|
| - |
|
46 |
'MOBILESTORE_XPATH7' : '//div[@id="priceComp"]/b/text()',
|
| - |
|
47 |
'MOBILESTORE_XPATH8' : '//span[@id="productLayoutForm:categoryNavigation:navigationList_0:navigationList1"]/text()',
|
| - |
|
48 |
'UNIVERCELL_DOMAINNAME' : "univercell",
|
| - |
|
49 |
'UNIVERCELL_URL' : "http://www.univercell.in/mobiles/populateStore.action",
|
| - |
|
50 |
'UNIVERCELL_HOMEPAGE' : "http://www.univercell.in",
|
| - |
|
51 |
'UNIVERCELL_REFERER' : "www.google.com/search",
|
| - |
|
52 |
'UNIVERCELL_URL1' : "http://www.univercell.in",
|
| - |
|
53 |
'UNIVERCELL_XPATH1' : '//div[@id="mobilesTab"]/table/tr[1]/td/table/tr',
|
| - |
|
54 |
'UNIVERCELL_XPATH2' : './/a/text()',
|
| - |
|
55 |
'UNIVERCELL_XPATH3' : './/a/@href',
|
| - |
|
56 |
'UNIVERCELL_VAR1' : ";",
|
| - |
|
57 |
'UNIVERCELL_VAR2' : "?",
|
| - |
|
58 |
'UNIVERCELL_VAR3' : "populate",
|
| - |
|
59 |
'UNIVERCELL_VAR4' : "rePopulate",
|
| - |
|
60 |
'UNIVERCELL_DOMAINNAME1' : "univercell1",
|
| - |
|
61 |
'UNIVERCELL_REMOVELIST' : ["Rs",",","-","/"],
|
| - |
|
62 |
'UNIVERCELL_XPATH4' : '//td[@class="gray-border"]',
|
| - |
|
63 |
'UNIVERCELL_XPATH5' : './/tr[2]/td/a/text()',
|
| - |
|
64 |
'UNIVERCELL_XPATH6' : './/tr[3]/th/label/text()',
|
| - |
|
65 |
'UNIVERCELL_VATPLUSTAX' : 0,
|
| - |
|
66 |
'BABUCHAK_DOMAINNAME' : "babuchak",
|
| - |
|
67 |
'BABUCHAK_URL' : "http://www.shopping.babuchak.com/visitourstores.php?view=productListPage&category=108",
|
| - |
|
68 |
'BABUCHAK_HOMEPAGE' : "http://www.shopping.babuchak.com",
|
| - |
|
69 |
'BABUCHAK_REFERER' : "www.google.com/search",
|
| - |
|
70 |
'BABUCHAK_URL1' : "http://www.shopping.babuchak.com/visitourstores.php",
|
| - |
|
71 |
'BABUCHAK_XPATH1' : '//td[@class="mod-category-header"]',
|
| - |
|
72 |
'BABUCHAK_XPATH2' : './/text()',
|
| - |
|
73 |
'BABUCHAK_XPATH3' : './/a/@href',
|
| - |
|
74 |
'BABUCHAK_DOMAINNAME1' : "babuchak1",
|
| - |
|
75 |
'BABUCHAK_VAR1' : "&postPage=",
|
| - |
|
76 |
'BABUCHAK_URL2' : "http://www.shopping.babuchak.com/visitourstores.php",
|
| - |
|
77 |
'BABUCHAK_XPATH4' : '//td[@class="mod-item-body-title"]/a/@href',
|
| - |
|
78 |
'BABUCHAK_DOMAINNAME2' : "babuchak2",
|
| - |
|
79 |
'BABUCHAK_XPATH5' : '//td[@class="text-header"]/text()',
|
| - |
|
80 |
'BABUCHAK_XPATH6' : '//td[@class="xl63"]//strong/span/text()',
|
| - |
|
81 |
'BABUCHAK_XPATH7' : '//td[@class="mod-item-body-title"]/b/text()',
|
| - |
|
82 |
'BABUCHAK_REMOVELIST' : ["Rs.","Rs",",","-","/"],
|
| - |
|
83 |
'NAAPTOL_DOMAINNAME' : "naaptol",
|
| - |
|
84 |
'NAAPTOL_URL' : "http://www.naaptol.com/sitemap.xml",
|
| - |
|
85 |
'NAAPTOL_HOMEPAGE' : "http://www.naaptol.com",
|
| - |
|
86 |
'NAAPTOL_REFERER' : "http://www.google.com",
|
| - |
|
87 |
'NAAPTOL_XPATH1' : '//url/loc/text()',
|
| - |
|
88 |
'NAAPTOL_CHKLIST1' : ["mobile_phones/pdas_and_smartphones" ,"mobile_phones/gsm_handsets" ,"mobile_phones/cdma_handsets"],
|
| - |
|
89 |
'NAAPTOL_DOMAINNAME1' : "naaptol1",
|
| - |
|
90 |
'NAAPTOL_DOMAINNAME2' : "naaptol2",
|
| - |
|
91 |
'NAAPTOL_CHKLIST2' : ['price'],
|
| - |
|
92 |
'NAAPTOL_PART' : "features",
|
| - |
|
93 |
'NAAPTOL_REMOVELIST' : ["Rs.",","],
|
| - |
|
94 |
'NAAPTOL_XPATH2' : '//table[@class ="ProductDetails"]//td[@class="Price"]/span/text()',
|
| - |
|
95 |
'NAAPTOL_XPATH3' : '//table[@class ="ProductDetails"]//td[@class="Price"]/span/script/text()',
|
| - |
|
96 |
'NAAPTOL_XPATH4' : '//div[@id="OnlineSellers"]//div[@class="ProductResultHead"]//div[@class="headingstyle"]/text()',
|
| - |
|
97 |
'NAAPTOL_XPATH5' : '//div[@id="onSellerContents"]//td[@class="price"]',
|
| - |
|
98 |
'NAAPTOL_XPATH6' : '//div[@id="onSellerContents"]//tr[@class="DottedBorder"]/td/a[@id="storeInfoPop',
|
| - |
|
99 |
'NAAPTOL_XPATH7' : '"]/span/text()',
|
| - |
|
100 |
'NAAPTOL_XPATH8' : '//div[@id="LocalStores"]//div[@class="ProductResultHead"]//div[@class="headingstyle"]/text()',
|
| - |
|
101 |
'NAAPTOL_XPATH9' : '//div[@id="offSellerContents"]//td[@class="price"]',
|
| - |
|
102 |
'NAAPTOL_XPATH10' : '//div[@id="offSellerContents"]//span[@class="LocalStoreHeading"]/text()'
|
| - |
|
103 |
}
|
| - |
|
104 |
|
| - |
|
105 |
|
| 10 |
def initialize_table():
|
106 |
def initialize_table():
|
| 11 |
"""
|
107 |
"""
|
| 12 |
Documentation for method initialize_table
|
108 |
Documentation for method initialize_table
|
| 13 |
It calls a method init() so that when one needs to access the helper methods of
|
109 |
It calls a method init() so that when one needs to access the helper methods of
|
| 14 |
this class to access database, the database tables are in the scope
|
110 |
this class to access database, the database tables are in the scope
|
| Line 53... |
Line 149... |
| 53 |
cw = code_words.query.filter_by(key=key).one()
|
149 |
cw = code_words.query.filter_by(key=key).one()
|
| 54 |
cw = cw.value
|
150 |
cw = cw.value
|
| 55 |
print key
|
151 |
print key
|
| 56 |
print cw
|
152 |
print cw
|
| 57 |
except:
|
153 |
except:
|
| - |
|
154 |
try:
|
| - |
|
155 |
cw = key_dict[key]
|
| - |
|
156 |
except:
|
| 58 |
cw = "EMPTY"
|
157 |
cw = "EMPTY"
|
| 59 |
return cw
|
158 |
return cw
|
| 60 |
|
159 |
|
| 61 |
def get_allcode_words(key):
|
160 |
def get_allcode_words(key):
|
| 62 |
"""
|
161 |
"""
|
| 63 |
Documentation for method get_allcode_words
|
162 |
Documentation for method get_allcode_words
|
| 64 |
This method is used to retrieve all the code_words given the key i.e name
|
163 |
This method is used to retrieve all the code_words given the key i.e name
|
| 65 |
"""
|
164 |
"""
|
| 66 |
try:
|
165 |
try:
|
| 67 |
cw = code_words.query.all()
|
166 |
cw = code_words.query.all()
|
| 68 |
except:
|
167 |
except:
|
| - |
|
168 |
try:
|
| - |
|
169 |
cw = key_dict.values()
|
| - |
|
170 |
except:
|
| 69 |
cw = "EMPTY"
|
171 |
cw = "EMPTY"
|
| 70 |
return cw
|
172 |
return cw
|
| 71 |
|
173 |
|
| 72 |
def get_code_word_byKey(key):
|
174 |
def get_code_word_byKey(key):
|
| 73 |
"""
|
175 |
"""
|
| 74 |
Documentation for method get_code_word_byKey
|
176 |
Documentation for method get_code_word_byKey
|
| 75 |
This method is used to retrieve the code_word given its key i.e name
|
177 |
This method is used to retrieve the code_word given its key i.e name
|
| 76 |
"""
|
178 |
"""
|
| 77 |
try:
|
179 |
try:
|
| 78 |
cw = code_words.query.filter_by(key=key).one()
|
180 |
cw = code_words.query.filter_by(key=key).one()
|
| 79 |
except:
|
181 |
except:
|
| - |
|
182 |
try:
|
| - |
|
183 |
cw = key_dict[key]
|
| - |
|
184 |
except:
|
| 80 |
cw = "EMPTY"
|
185 |
cw = "EMPTY"
|
| 81 |
return cw
|
186 |
return cw
|