Subversion Repositories SmartDukaan

Rev

Rev 175 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 175 Rev 224
Line 14... Line 14...
14
 
14
 
15
if not phones:
15
if not phones:
16
    print "Error while getting phones"
16
    print "Error while getting phones"
17
    sys.exit(-1)
17
    sys.exit(-1)
18
 
18
 
19
file_to_write = "/tmp/allprices.csv"
-
 
20
 
19
 
-
 
20
file_to_write = "/tmp/allprices.csv"
21
data_file = open(file_to_write,"w")
21
data_file = open(file_to_write,"w")
22
 
22
 
-
 
23
infibeam_ct = indiaplaza_ct = mobilestore_ct = univercell_ct = babuchak_ct = 0
-
 
24
csv_data =  "%s, %s, %s, %s, %s, %s, %s \n" %('brand', 'model', 'infibeam_price', 'indiaplaza_price', 'mobilestore_price', 'univercell_price', 'babuchak_price' )
-
 
25
data_file.write(csv_data)
23
for phone in phone_list:
26
for phone in phone_list:
24
    id = phone.id
27
    id = phone.id
25
    #get all prices for this phone
28
    #get all prices for this phone
26
    try:
29
    try:
27
        infibeam_price = phones.get_price_by_model(id, 1).final_price
30
        infibeam_price = phones.get_price_by_model(id, 71).final_price
-
 
31
        infibeam_ct = infibeam_ct+1 
28
    except:
32
    except:
29
        infibeam_price = " "
33
        infibeam_price = " "
30
        
34
        
31
    try:
35
    try:
32
        indiaplaza_price = phones.get_price_by_model(id, 2).final_price
36
        indiaplaza_price = phones.get_price_by_model(id, 72).final_price
-
 
37
        indiaplaza_ct = indiaplaza_ct+1 
33
    except:
38
    except:
34
        indiaplaza_price = " "
39
        indiaplaza_price = " "
35
        
40
        
36
    try:
41
    try:
37
        mobilestore_price = phones.get_price_by_model(id, 3).final_price
42
        mobilestore_price = phones.get_price_by_model(id, 68).final_price
-
 
43
        mobilestore_ct = mobilestore_ct+1
38
    except:
44
    except:
39
        mobilestore_price = " "
45
        mobilestore_price = " "
-
 
46
    
40
    try:
47
    try:
41
        univercell_price = phones.get_price_by_model(id, 4).final_price
48
        univercell_price = phones.get_price_by_model(id, 70).final_price
-
 
49
        univercell_ct = univercell_ct+1
42
    except:
50
    except:
43
        univercell_price = " "
51
        univercell_price = " "
44
    
52
    
45
    try:
53
    try:
-
 
54
        babuchak_price = phones.get_price_by_model(id, 69).final_price
-
 
55
        babuchak_ct = babuchak_ct+1
-
 
56
    except:
-
 
57
        babuchak_price = " "
-
 
58
    
-
 
59
    if infibeam_price == " " and indiaplaza_price == " " and mobilestore_price == " " and univercell_price == " " and babuchak_price == " ":
-
 
60
        continue    
-
 
61
    csv_data =  "%s, %s, %s, %s, %s, %s, %s \n" %(phone.brand, phone.model, str(infibeam_price), str(indiaplaza_price), str(mobilestore_price), str(univercell_price), str(babuchak_price) )
-
 
62
    data_file.write(csv_data)
-
 
63
        
-
 
64
'''
-
 
65
    try:
46
        ginfo = phones.get_gs_bymid(id)
66
        ginfo = phones.get_gs_bymid(id)
47
        try:
67
        try:
48
            guarntee_info = ginfo.guaranteeinfo
68
            guarntee_info = ginfo.guaranteeinfo
49
        except:
69
        except:
50
            guarntee_info = " "
70
            guarntee_info = " "
Line 53... Line 73...
53
        except:
73
        except:
54
            ship_info = " "        
74
            ship_info = " "        
55
    except:
75
    except:
56
        guarntee_info = " "
76
        guarntee_info = " "
57
        ship_info = " "     
77
        ship_info = " "     
58
    
-
 
59
    
78
        
60
    csv_data =  "%s, %s, %s, %s, %s, %s, %s, %s \n" %(phone.brand, phone.model, str(infibeam_price), str(indiaplaza_price), guarntee_info, ship_info, str(mobilestore_price), str(univercell_price))
79
    csv_data =  "%s, %s, %s, %s, %s, %s, %s, %s \n" %(phone.brand, phone.model, str(infibeam_price), str(indiaplaza_price), guarntee_info, ship_info, str(mobilestore_price), str(univercell_price))
61
    data_file.write(csv_data)
80
    data_file.write(csv_data)
62
    
81
    '''
-
 
82
csv_data =  "%s, %s, %s, %s, %s, %s, %s \n" %('total count ', ' ', str(infibeam_ct), str(indiaplaza_ct), str(mobilestore_ct), str(univercell_ct), str(babuchak_ct) )
-
 
83
data_file.write(csv_data)
63
data_file.close()
84
data_file.close()
64
 
85