| Line 27... |
Line 27... |
| 27 |
try:
|
27 |
try:
|
| 28 |
import ordereddict
|
28 |
import ordereddict
|
| 29 |
except:
|
29 |
except:
|
| 30 |
pass
|
30 |
pass
|
| 31 |
|
31 |
|
| - |
|
32 |
|
| - |
|
33 |
import bson.son as son
|
| 32 |
con = None
|
34 |
con = None
|
| 33 |
es = None
|
35 |
es = None
|
| 34 |
try:
|
36 |
try:
|
| 35 |
from elasticsearch import Elasticsearch
|
37 |
from elasticsearch import Elasticsearch
|
| 36 |
except:
|
38 |
except:
|
| Line 839... |
Line 841... |
| 839 |
except:
|
841 |
except:
|
| 840 |
item[0]['ppq'] = 0
|
842 |
item[0]['ppq'] = 0
|
| 841 |
if filterData is None:
|
843 |
if filterData is None:
|
| 842 |
if item[0]['category_id']!=6:
|
844 |
if item[0]['category_id']!=6:
|
| 843 |
try:
|
845 |
try:
|
| 844 |
item[0]['filterLink'] = '/category/'+str(int(item[0]['category_id']))+'?searchFor='+urllib.quote(item[0]['brand'])+'&filter=brand&brands='+str(int(item[0]['brand_id']))
|
846 |
item[0]['filterLinkBrand'] = '/category/'+str(int(item[0]['category_id']))+'?searchFor='+urllib.quote(item[0]['brand'])+'&filter=brand&brands='+str(int(item[0]['brand_id']))
|
| 845 |
item[0]['filterText'] = 'More %s items'%(item[0]['brand'])
|
847 |
item[0]['filterTextBrand'] = (item[0]['brand'])
|
| 846 |
except:
|
848 |
except:
|
| 847 |
item[0]['filterLink'] = ""
|
- |
|
| 848 |
item[0]['filterText'] = ""
|
849 |
pass
|
| 849 |
else:
|
850 |
else:
|
| 850 |
try:
|
851 |
try:
|
| 851 |
if item[0]['subCategory']=='' or item[0]['subCategory'] is None or item[0]['subCategoryId']==0:
|
852 |
if item[0]['subCategory']=='' or item[0]['subCategory'] is None or item[0]['subCategoryId']==0:
|
| 852 |
raise
|
853 |
raise
|
| 853 |
item[0]['filterLink'] = '/category/'+str(int(item[0]['category_id']))+'?searchFor='+urllib.quote(item[0]['subCategory'])+'&filter=subcategory&subcategories='+str(int(item[0]['subCategoryId']))
|
854 |
item[0]['filterLinkSubCategory'] = '/category/'+str(int(item[0]['category_id']))+'?searchFor='+urllib.quote(item[0]['subCategory'])+'&filter=subcategory&subcategories='+str(int(item[0]['subCategoryId']))
|
| 854 |
item[0]['filterText'] = 'More %s'%(item[0]['subCategory'])
|
855 |
item[0]['filterTextSubCategory'] = (item[0]['subCategory'])
|
| - |
|
856 |
item[0]['filterLinkBrand'] = '/category/'+str(int(item[0]['category_id']))+'?searchFor='+urllib.quote(item[0]['brand'])+'&filter=brand&brands='+str(int(item[0]['brand_id']))
|
| - |
|
857 |
item[0]['filterTextBrand'] = (item[0]['brand'])
|
| 855 |
except:
|
858 |
except:
|
| 856 |
item[0]['filterLink'] = ''
|
- |
|
| 857 |
item[0]['filterText'] = ""
|
859 |
pass
|
| 858 |
try:
|
860 |
try:
|
| 859 |
if item[0]['source_id']==4:
|
861 |
if item[0]['source_id']==4:
|
| 860 |
item_availability_info = mc.get("item_availability_"+str(item[0]['identifier']).strip())
|
862 |
item_availability_info = mc.get("item_availability_"+str(item[0]['identifier']).strip())
|
| 861 |
if item_availability_info is None or len(item_availability_info)==0:
|
863 |
if item_availability_info is None or len(item_availability_info)==0:
|
| 862 |
item[0]['availabilityInfo'] = [{}]
|
864 |
item[0]['availabilityInfo'] = [{}]
|
| Line 1814... |
Line 1816... |
| 1814 |
item[0]['ppq'] = round(ppq,2)
|
1816 |
item[0]['ppq'] = round(ppq,2)
|
| 1815 |
else:
|
1817 |
else:
|
| 1816 |
item[0]['ppq'] = 0
|
1818 |
item[0]['ppq'] = 0
|
| 1817 |
except:
|
1819 |
except:
|
| 1818 |
item[0]['ppq'] = 0
|
1820 |
item[0]['ppq'] = 0
|
| 1819 |
|
- |
|
| 1820 |
if item[0]['category_id']!=6:
|
1821 |
if item[0]['category_id']!=6:
|
| 1821 |
try:
|
1822 |
try:
|
| 1822 |
item[0]['filterLink'] = '/category/'+str(int(item[0]['category_id']))+'?searchFor='+urllib.quote(item[0]['brand'])+'&filter=brand&brands='+str(int(item[0]['brand_id']))
|
1823 |
item[0]['filterLinkBrand'] = '/category/'+str(int(item[0]['category_id']))+'?searchFor='+urllib.quote(item[0]['brand'])+'&filter=brand&brands='+str(int(item[0]['brand_id']))
|
| 1823 |
item[0]['filterText'] = 'More %s items'%(item[0]['brand'])
|
1824 |
item[0]['filterTextBrand'] = (item[0]['brand'])
|
| 1824 |
except:
|
1825 |
except:
|
| 1825 |
item[0]['filterLink'] = ""
|
- |
|
| 1826 |
item[0]['filterText'] = ""
|
1826 |
pass
|
| 1827 |
else:
|
1827 |
else:
|
| 1828 |
try:
|
1828 |
try:
|
| 1829 |
if item[0]['subCategory']=='' or item[0]['subCategory'] is None or item[0]['subCategoryId']==0:
|
1829 |
if item[0]['subCategory']=='' or item[0]['subCategory'] is None or item[0]['subCategoryId']==0:
|
| 1830 |
raise
|
1830 |
raise
|
| 1831 |
item[0]['filterLink'] = '/category/'+str(int(item[0]['category_id']))+'?searchFor='+urllib.quote(item[0]['subCategory'])+'&filter=subcategory&subcategories='+str(int(item[0]['subCategoryId']))
|
1831 |
item[0]['filterLinkSubCategory'] = '/category/'+str(int(item[0]['category_id']))+'?searchFor='+urllib.quote(item[0]['subCategory'])+'&filter=subcategory&subcategories='+str(int(item[0]['subCategoryId']))
|
| 1832 |
item[0]['filterText'] = 'More %s'%(item[0]['subCategory'])
|
1832 |
item[0]['filterTextSubCategory'] = (item[0]['subCategory'])
|
| - |
|
1833 |
item[0]['filterLinkBrand'] = '/category/'+str(int(item[0]['category_id']))+'?searchFor='+urllib.quote(item[0]['brand'])+'&filter=brand&brands='+str(int(item[0]['brand_id']))
|
| - |
|
1834 |
item[0]['filterTextBrand'] = (item[0]['brand'])
|
| 1833 |
except:
|
1835 |
except:
|
| 1834 |
item[0]['filterLink'] = ''
|
- |
|
| 1835 |
item[0]['filterText'] = ""
|
1836 |
pass
|
| 1836 |
try:
|
1837 |
try:
|
| 1837 |
if item[0]['source_id']==4:
|
1838 |
if item[0]['source_id']==4:
|
| 1838 |
item_availability_info = mc.get("item_availability_"+str(item[0]['identifier']).strip())
|
1839 |
item_availability_info = mc.get("item_availability_"+str(item[0]['identifier']).strip())
|
| 1839 |
if item_availability_info is None or len(item_availability_info)==0:
|
1840 |
if item_availability_info is None or len(item_availability_info)==0:
|
| 1840 |
item[0]['availabilityInfo'] = [{}]
|
1841 |
item[0]['availabilityInfo'] = [{}]
|
| Line 2524... |
Line 2525... |
| 2524 |
item[0]['ppq'] = 0
|
2525 |
item[0]['ppq'] = 0
|
| 2525 |
except:
|
2526 |
except:
|
| 2526 |
item[0]['ppq'] = 0
|
2527 |
item[0]['ppq'] = 0
|
| 2527 |
if item[0]['category_id']!=6:
|
2528 |
if item[0]['category_id']!=6:
|
| 2528 |
try:
|
2529 |
try:
|
| 2529 |
item[0]['filterLink'] = '/category/'+str(int(item[0]['category_id']))+'?searchFor='+urllib.quote(item[0]['brand'])+'&filter=brand&brands='+str(int(item[0]['brand_id']))
|
2530 |
item[0]['filterLinkBrand'] = '/category/'+str(int(item[0]['category_id']))+'?searchFor='+urllib.quote(item[0]['brand'])+'&filter=brand&brands='+str(int(item[0]['brand_id']))
|
| 2530 |
item[0]['filterText'] = 'More %s items'%(item[0]['brand'])
|
2531 |
item[0]['filterTextBrand'] = (item[0]['brand'])
|
| 2531 |
except:
|
2532 |
except:
|
| 2532 |
item[0]['filterLink'] = ""
|
- |
|
| 2533 |
item[0]['filterText'] = ""
|
2533 |
pass
|
| 2534 |
else:
|
2534 |
else:
|
| 2535 |
try:
|
2535 |
try:
|
| 2536 |
if item[0]['subCategory']=='' or item[0]['subCategory'] is None or item[0]['subCategoryId']==0:
|
2536 |
if item[0]['subCategory']=='' or item[0]['subCategory'] is None or item[0]['subCategoryId']==0:
|
| 2537 |
raise
|
2537 |
raise
|
| 2538 |
item[0]['filterLink'] = '/category/'+str(int(item[0]['category_id']))+'?searchFor='+urllib.quote(item[0]['subCategory'])+'&filter=subcategory&subcategories='+str(int(item[0]['subCategoryId']))
|
2538 |
item[0]['filterLinkSubCategory'] = '/category/'+str(int(item[0]['category_id']))+'?searchFor='+urllib.quote(item[0]['subCategory'])+'&filter=subcategory&subcategories='+str(int(item[0]['subCategoryId']))
|
| 2539 |
item[0]['filterText'] = 'More %s'%(item[0]['subCategory'])
|
2539 |
item[0]['filterTextSubCategory'] = (item[0]['subCategory'])
|
| - |
|
2540 |
item[0]['filterLinkBrand'] = '/category/'+str(int(item[0]['category_id']))+'?searchFor='+urllib.quote(item[0]['brand'])+'&filter=brand&brands='+str(int(item[0]['brand_id']))
|
| - |
|
2541 |
item[0]['filterTextBrand'] = (item[0]['brand'])
|
| 2540 |
except:
|
2542 |
except:
|
| 2541 |
item[0]['filterLink'] = ''
|
- |
|
| 2542 |
item[0]['filterText'] = ""
|
2543 |
pass
|
| 2543 |
try:
|
2544 |
try:
|
| 2544 |
if item[0]['source_id']==4:
|
2545 |
if item[0]['source_id']==4:
|
| 2545 |
item_availability_info = mc.get("item_availability_"+str(item[0]['identifier']).strip())
|
2546 |
item_availability_info = mc.get("item_availability_"+str(item[0]['identifier']).strip())
|
| 2546 |
if item_availability_info is None or len(item_availability_info)==0:
|
2547 |
if item_availability_info is None or len(item_availability_info)==0:
|
| 2547 |
item[0]['availabilityInfo'] = [{}]
|
2548 |
item[0]['availabilityInfo'] = [{}]
|
| Line 2551... |
Line 2552... |
| 2551 |
item[0]['availabilityInfo'] = [{}]
|
2552 |
item[0]['availabilityInfo'] = [{}]
|
| 2552 |
return item[0]
|
2553 |
return item[0]
|
| 2553 |
|
2554 |
|
| 2554 |
|
2555 |
|
| 2555 |
def main():
|
2556 |
def main():
|
| 2556 |
"8-cable , 15- charger, 20-screen guard"
|
2557 |
print datetime.now()
|
| 2557 |
|
- |
|
| 2558 |
res = getDealsForSearchText("20^8","iph",0,1000)
|
2558 |
getNewDeals(47, 6, 0, 20, None, None, None)
|
| 2559 |
for i in res:
|
- |
|
| 2560 |
print i
|
2559 |
print datetime.now()
|
| 2561 |
|
2560 |
|
| 2562 |
if __name__=='__main__':
|
2561 |
if __name__=='__main__':
|
| 2563 |
main()
|
2562 |
main()
|
| 2564 |
|
2563 |
|
| 2565 |
|
2564 |
|