Beispiel #1
0
 def testSinglePage_ERJ3EKF2001V(self):
     if 1:
         from rs.core import Rs
         rs = Rs("ERJ3EKF2001V",1,0)
         self.page = rs.getPage()
         with open("rs_ERJ3EKF2001V.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()      
Beispiel #2
0
 def testSinglePage_ERJ3EKF2001V(self):
     if 1:
         from rs.core import Rs
         rs = Rs("ERJ3EKF2001V", 1, 0)
         self.page = rs.getPage()
         with open("rs_ERJ3EKF2001V.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()
Beispiel #3
0
 def testSinglePage_702_002_10_00(self):
     if 1:
         from rs.core import Rs
         rs = Rs("702-002-10-00",1,0)
         self.page = rs.getPage()
         with open("rs_702-002-10-00.xml", "ab") as myfile:
             myfile.write(self.page)
         rs.parse()           
Beispiel #4
0
 def testSinglePage_24AA16T_I_OT(self):
     if 1:
         from rs.core import Rs
         rs = Rs("24AA16T-I/OT",1,0)
         self.page = rs.getPage()
         with open("rs_24AA16T_I_OT.xml", "ab") as myfile:
             myfile.write(self.page)
         rs.parse() 
Beispiel #5
0
 def testSinglePage_nichtlieferbar(self):
     if 1:
         from rs.core import Rs
         rs = Rs("815-1361",1,0)
         self.page = rs.getPage()
         with open("rs_singleresult_nichtlieferbar.xml", "ab") as myfile:
             myfile.write(self.page)
         rs.parse() 
Beispiel #6
0
 def testSinglePage_HirschmannTestMeasurement  (self):
     if 1:
         from rs.core import Rs
         rs = Rs("Hirschmann Test & Measurement",1,0)
         self.page = rs.getPage()
         with open("rs_HirschmannTestMeasurement.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()   
         self.assertTrue(len(result['ausUSA']) > 10)
Beispiel #7
0
 def testSinglePage_HirschmannTestMeasurement(self):
     if 1:
         from rs.core import Rs
         rs = Rs("Hirschmann Test & Measurement", 1, 0)
         self.page = rs.getPage()
         with open("rs_HirschmannTestMeasurement.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()
         self.assertTrue(len(result['ausUSA']) > 10)
Beispiel #8
0
    def testSinglePage_MC0603X105K160CT(self):
        if 1:
            from rs.core import Rs
            rs = Rs("MC0603X105K160CT", 1, 0)
            self.page = rs.getPage()
            with open("MC0603X105K160CT.xml", "ab") as myfile:
                myfile.write(self.page)
            result = rs.parse()
            print result

            self.assertEqual(result['minVPE'], [-1])
Beispiel #9
0
 def testSinglePage_MC0603X105K160CT  (self):
     if 1:
         from rs.core import Rs
         rs = Rs("MC0603X105K160CT",1,0)
         self.page = rs.getPage()
         with open("MC0603X105K160CT.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()   
         print result 
         
         self.assertEqual(result['minVPE'], [-1])
Beispiel #10
0
 def testSinglePage_T491B476K010A(self):
     if 1:
         from rs.core import Rs
         rs = Rs("T491B476K010A",1,0)
         self.page = rs.getPage()
         with open("rs_T491B476K010A.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()   
         self.assertEqual(result['minVPE'], [10])
         self.assertIn('Lieferbar' , result['stock'][0])
         self.assertEqual(result['supplier'], ['RS'])
         self.assertEqual(result['mpn'], ['T491B476K010AT'])            
         self.assertEqual(result['ausUSA'], [0])
         self.assertEqual(result['ordercode'],  ['648-0597'])
         self.assertEqual(result['prices'], [[0.82, 0.65]])
         self.assertEqual(result['pricebreaks'], [[10, 50]])
         self.assertEqual(result['manufacturer'],  ['KEMET'])
Beispiel #11
0
 def testSinglePage_FSM4JSMA(self):
     if 1:
         from rs.core import Rs
         rs = Rs("FSM4JSMA",1,0)
         self.page = rs.getPage()
         with open("FSM4JSMA.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()    
         self.assertEqual(result['minVPE'], [5,1])
         self.assertEqual(result['stock'], [-1, -1] )
         self.assertEqual(result['supplier'], ['RS','RS'])
         self.assertEqual(result['mpn'], ['FSM4JSMATR','FSM4JSMA'])            
         self.assertEqual(result['ausUSA'], [0,0])
         self.assertEqual(result['ordercode'],  ['718-2455','875-0598'])
         self.assertEqual(result['prices'], [[0.332], [3354.70]])
         self.assertEqual(result['pricebreaks'], [[5],[1]])
         self.assertEqual(result['manufacturer'],  ['TE Connectivity','TE Connectivity'])
Beispiel #12
0
 def testSinglePage_702_002_10_00(self):
     if 1:
         from rs.core import Rs
         rs = Rs("702-002-10-00", 1, 0)
         self.page = rs.getPage()
         with open("rs_702-002-10-00.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()
         self.assertEqual(result['minVPE'], [-1])
         self.assertEqual(result['stock'], [-1])
         self.assertEqual(result['supplier'], ['RS'])
         self.assertEqual(result['mpn'], ['-'])
         self.assertEqual(result['ausUSA'], [-1])
         self.assertEqual(result['ordercode'], ['-1'])
         self.assertEqual(result['prices'], [[-1]])
         self.assertEqual(result['pricebreaks'], [[-1]])
         self.assertEqual(result['manufacturer'], ['-'])
Beispiel #13
0
 def testSinglePage_FT230XS  (self):
     if 1:
         from rs.core import Rs
         rs = Rs("FT230XS",1,0)
         self.page = rs.getPage()
         with open("rs_FT230XS.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()   
         self.assertEqual(result['minVPE'], ['2'])
         self.assertIn('Lieferbar' , result['stock'][0])
         self.assertEqual(result['supplier'], ['RS'])
         self.assertEqual(result['mpn'], ['FT230XS-R'])            
         self.assertEqual(result['ausUSA'], [0])
         self.assertEqual(result['ordercode'],  ['757-0010'])
         self.assertEqual(result['prices'], [[2.06, 1.97]])
         self.assertEqual(result['pricebreaks'], [[2, 10]])
         self.assertEqual(result['manufacturer'],  ['FTDI Chip'])            
Beispiel #14
0
 def testSinglePage_T491B476K010A(self):
     if 1:
         from rs.core import Rs
         rs = Rs("T491B476K010A", 1, 0)
         self.page = rs.getPage()
         with open("rs_T491B476K010A.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()
         self.assertEqual(result['minVPE'], [10])
         self.assertIn('Lieferbar', result['stock'][0])
         self.assertEqual(result['supplier'], ['RS'])
         self.assertEqual(result['mpn'], ['T491B476K010AT'])
         self.assertEqual(result['ausUSA'], [0])
         self.assertEqual(result['ordercode'], ['648-0597'])
         self.assertEqual(result['prices'], [[0.82, 0.65]])
         self.assertEqual(result['pricebreaks'], [[10, 50]])
         self.assertEqual(result['manufacturer'], ['KEMET'])
Beispiel #15
0
 def testSinglePage_702_002_10_00(self):
     if 1:
         from rs.core import Rs
         rs = Rs("702-002-10-00",1,0)
         self.page = rs.getPage()
         with open("rs_702-002-10-00.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()  
         self.assertEqual(result['minVPE'], [-1])
         self.assertEqual(result['stock'], [-1] )
         self.assertEqual(result['supplier'], ['RS'])
         self.assertEqual(result['mpn'], ['-'])            
         self.assertEqual(result['ausUSA'], [-1])
         self.assertEqual(result['ordercode'],  ['-1'])
         self.assertEqual(result['prices'], [[-1]])
         self.assertEqual(result['pricebreaks'], [[-1]])
         self.assertEqual(result['manufacturer'],  ['-'])
Beispiel #16
0
 def testSinglePage_24AA16T_I_OT(self):
     if 1:
         from rs.core import Rs
         rs = Rs("24AA16T-I/OT",1,0)
         self.page = rs.getPage()
         with open("rs_24AA16T_I_OT.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse() 
         self.assertEqual(result['minVPE'], [1,1,26])
         self.assertEqual(result['stock'], [-1, -1, -1] )
         self.assertEqual(result['supplier'], ['RS','RS','RS'])
         self.assertEqual(result['mpn'], ['24AA16T-I/OT','24AA16T-I/OT','24AA16T-I/OT'])            
         self.assertEqual(result['ausUSA'], [0,0,0])
         self.assertEqual(result['ordercode'],  ['687-9177','687-9177P','2509537378'])
         self.assertEqual(result['prices'], [[0.30], [0.30], [0.54]])
         self.assertEqual(result['pricebreaks'], [[1],[1],[26]])
         self.assertEqual(result['manufacturer'],  ['Microchip','Microchip','Microchip'])
Beispiel #17
0
 def testSinglePage_nichtlieferbar(self):
     if 1:
         from rs.core import Rs
         rs = Rs("815-1361",1,0)
         self.page = rs.getPage()
         with open("rs_singleresult_nichtlieferbar.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse() 
         self.assertEqual(result['minVPE'], [200])
         self.assertEqual(result['stock'], ['Lieferbar'] )
         self.assertEqual(result['supplier'], ['RS'])
         self.assertEqual(result['mpn'], ['GRM188R61A105MA61D'])            
         self.assertEqual(result['ausUSA'], [0])
         self.assertEqual(result['ordercode'],  ['815-1361'])
         self.assertEqual(result['prices'], [[0.018, 0.015]])
         self.assertEqual(result['pricebreaks'], [[200,1000]])
         self.assertEqual(result['manufacturer'],  ['Murata'])
Beispiel #18
0
 def testSinglePage_nichtlieferbar(self):
     if 1:
         from rs.core import Rs
         rs = Rs("815-1361", 1, 0)
         self.page = rs.getPage()
         with open("rs_singleresult_nichtlieferbar.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()
         self.assertEqual(result['minVPE'], [200])
         self.assertEqual(result['stock'], ['Lieferbar'])
         self.assertEqual(result['supplier'], ['RS'])
         self.assertEqual(result['mpn'], ['GRM188R61A105MA61D'])
         self.assertEqual(result['ausUSA'], [0])
         self.assertEqual(result['ordercode'], ['815-1361'])
         self.assertEqual(result['prices'], [[0.018, 0.015]])
         self.assertEqual(result['pricebreaks'], [[200, 1000]])
         self.assertEqual(result['manufacturer'], ['Murata'])
Beispiel #19
0
 def testSinglePage_FT230XS  (self):
     if 1:
         from rs.core import Rs
         rs = Rs("FT230XS",1,0)
         self.page = rs.getPage()
         with open("rs_FT230XS.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()   
         self.assertEqual(result['minVPE'], [10,2])
         self.assertEqual(result['stock'], [-1, -1] )
         #self.assertIn('Lieferbar' , result['stock'],[0,0])
         self.assertEqual(result['supplier'], ['RS', 'RS'])
         self.assertEqual(result['mpn'], ['FT230XS-U', 'FT230XS-R'])            
         self.assertEqual(result['ausUSA'], [0,0])
         self.assertEqual(result['ordercode'],  ['888-8710', '757-0010'])
         self.assertEqual(result['prices'], [[1.515], [1.86]])
         self.assertEqual(result['pricebreaks'], [[10],[2 ]])
         self.assertEqual(result['manufacturer'],  ['FTDI Chip','FTDI Chip'])            
Beispiel #20
0
 def testSinglePage_572_0500(self):
     if 1:
         from rs.core import Rs
         rs = Rs("572-0500", 1, 0)
         self.page = rs.getPage()
         with open("rs_572_0500.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()
         #print result
         self.assertEqual(result['minVPE'], [5, 1])
         self.assertEqual(result['stock'], [-1, -1])
         self.assertEqual(result['supplier'], ['RS', 'RS'])
         self.assertEqual(result['mpn'], ['-', '-'])
         self.assertEqual(result['ausUSA'], [0, 0])
         self.assertEqual(result['ordercode'], ['103-6555', '381-4745'])
         self.assertEqual(result['prices'], [[2.452], [18.93]])
         self.assertEqual(result['pricebreaks'], [[5], [1]])
         self.assertEqual(result['manufacturer'], ['RS Pro', 'RS Pro'])
Beispiel #21
0
 def testSinglePage_LIS331DLH(self):
     if 1:
         from rs.core import Rs
         rs = Rs("LIS331DLH", 1, 0)
         self.page = rs.getPage()
         with open("rs_LIS331DLH.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()
         #print result
         self.assertEqual(result['minVPE'], [1])
         self.assertEqual(result['stock'], ['Lieferbar'])
         self.assertEqual(result['supplier'], ['RS'])
         self.assertEqual(result['mpn'], ['LIS331DLH'])
         self.assertEqual(result['ausUSA'], [0])
         self.assertEqual(result['ordercode'], ['714-7910'])
         self.assertEqual(result['prices'], [[2.76, 2.12]])
         self.assertEqual(result['pricebreaks'], [[1, 10]])
         self.assertEqual(result['manufacturer'], ['STMicroelectronics'])
Beispiel #22
0
 def testSinglePage_20_313137(self):
     if 1:
         from rs.core import Rs
         rs = Rs("20-313137", 1, 0)
         self.page = rs.getPage()
         with open("rs_20-313137.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()
         #print result
         self.assertEqual(result['minVPE'], [100])
         self.assertIn('Lieferbar', result['stock'][0])
         self.assertEqual(result['supplier'], ['RS'])
         self.assertEqual(result['mpn'], ['20-313137'])
         self.assertEqual(result['ausUSA'], [0])
         self.assertEqual(result['ordercode'], ['508-0685'])
         self.assertEqual(result['prices'], [[0.261]])
         self.assertEqual(result['pricebreaks'], [[100]])
         self.assertEqual(result['manufacturer'], ['Vero Technologies'])
Beispiel #23
0
 def testSinglePage_FSM4JSMA(self):
     if 1:
         from rs.core import Rs
         rs = Rs("FSM4JSMA", 1, 0)
         self.page = rs.getPage()
         with open("FSM4JSMA.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()
         self.assertEqual(result['minVPE'], [5, 1])
         self.assertEqual(result['stock'], [-1, -1])
         self.assertEqual(result['supplier'], ['RS', 'RS'])
         self.assertEqual(result['mpn'], ['FSM4JSMATR', 'FSM4JSMA'])
         self.assertEqual(result['ausUSA'], [0, 0])
         self.assertEqual(result['ordercode'], ['718-2455', '875-0598'])
         self.assertEqual(result['prices'], [[0.332], [3354.70]])
         self.assertEqual(result['pricebreaks'], [[5], [1]])
         self.assertEqual(result['manufacturer'],
                          ['TE Connectivity', 'TE Connectivity'])
Beispiel #24
0
 def testSinglePage_LIS331DLH(self):
     if 1:
         from rs.core import Rs
         rs = Rs("LIS331DLH",1,0)
         self.page = rs.getPage()
         with open("rs_LIS331DLH.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()   
         #print result
         self.assertEqual(result['minVPE'], [1, 1])
         self.assertEqual(result['stock'], [-1, -1] )
         self.assertEqual(result['supplier'], ['RS', 'RS'])
         self.assertEqual(result['mpn'], ['LIS331DLH', 'STEVAL-MKI089V1'])            
         self.assertEqual(result['ausUSA'], [0,0])
         self.assertEqual(result['ordercode'],  ['714-7910', '717-3751'])
         self.assertEqual(result['prices'], [[2.42], [24.0]])
         self.assertEqual(result['pricebreaks'], [[1], [1]])
         self.assertEqual(result['manufacturer'],  ['STMicroelectronics', 'STMicroelectronics'])
Beispiel #25
0
 def testSinglePage_20_313137(self):
     if 1:
         from rs.core import Rs
         rs = Rs("20-313137",1,0)
         self.page = rs.getPage()
         with open("rs_20-313137.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()   
         #print result
         self.assertEqual(result['minVPE'], [100])
         self.assertIn('Lieferbar' , result['stock'][0])
         self.assertEqual(result['supplier'], ['RS'])
         self.assertEqual(result['mpn'], ['20-313137'])            
         self.assertEqual(result['ausUSA'], [0])
         self.assertEqual(result['ordercode'],  ['508-0685'])
         self.assertEqual(result['prices'], [[0.261]])
         self.assertEqual(result['pricebreaks'], [[100]])
         self.assertEqual(result['manufacturer'],  ['Vero Technologies'])
Beispiel #26
0
 def testSinglePage_LIS331DLH(self):
     if 1:
         from rs.core import Rs
         rs = Rs("LIS331DLH",1,0)
         self.page = rs.getPage()
         with open("rs_LIS331DLH.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()   
         #print result
         self.assertEqual(result['minVPE'], [1])
         self.assertEqual(result['stock'], ['Lieferbar'] )
         self.assertEqual(result['supplier'], ['RS'])
         self.assertEqual(result['mpn'], ['LIS331DLH'])            
         self.assertEqual(result['ausUSA'], [0])
         self.assertEqual(result['ordercode'],  ['714-7910'])
         self.assertEqual(result['prices'], [[2.76,2.12]])
         self.assertEqual(result['pricebreaks'], [[1,10]])
         self.assertEqual(result['manufacturer'],  ['STMicroelectronics'])
Beispiel #27
0
 def testSinglePage_572_0500(self):
     if 1:
         from rs.core import Rs
         rs = Rs("572-0500",1,0)
         self.page = rs.getPage()
         with open("rs_572_0500.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()   
         #print result
         self.assertEqual(result['minVPE'], [5, 1])
         self.assertEqual(result['stock'], [-1, -1] )
         self.assertEqual(result['supplier'], ['RS', 'RS'])
         self.assertEqual(result['mpn'], ['-', '-'])            
         self.assertEqual(result['ausUSA'], [0,0])
         self.assertEqual(result['ordercode'],  ['103-6555', '381-4745'])
         self.assertEqual(result['prices'], [[2.452], [18.93]])
         self.assertEqual(result['pricebreaks'], [[5], [1]])
         self.assertEqual(result['manufacturer'],  ['RS Pro', 'RS Pro'])            
Beispiel #28
0
 def testSinglePage_MCP4921_E_MS(self):
     if 1:
         from rs.core import Rs
         rs = Rs("MCP4921-E/MS", 1, 0)
         self.page = rs.getPage()
         with open("rs_MCP4921_E_MS.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()
         #print result
         self.assertEqual(result['minVPE'], [2])
         self.assertIn('Lieferbar', result['stock'][0])
         self.assertEqual(result['supplier'], ['RS'])
         self.assertEqual(result['mpn'], ['MCP4921-E/MS'])
         self.assertEqual(result['ausUSA'], [0])
         self.assertEqual(result['ordercode'], ['738-6705'])
         self.assertEqual(result['prices'], [[1.97, 1.87]])
         self.assertEqual(result['pricebreaks'], [[2, 10]])
         self.assertEqual(result['manufacturer'], ['Microchip'])
Beispiel #29
0
 def testSinglePage_MCP4921_E_MS  (self):
     if 1:
         from rs.core import Rs
         rs = Rs("MCP4921-E/MS",1,0)
         self.page = rs.getPage()
         with open("rs_MCP4921_E_MS.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()   
         #print result 
         self.assertEqual(result['minVPE'], [2])
         self.assertIn('Lieferbar' , result['stock'][0])
         self.assertEqual(result['supplier'], ['RS'])
         self.assertEqual(result['mpn'], ['MCP4921-E/MS'])            
         self.assertEqual(result['ausUSA'], [0])
         self.assertEqual(result['ordercode'],  ['738-6705'])
         self.assertEqual(result['prices'], [[1.97, 1.87]])
         self.assertEqual(result['pricebreaks'], [[2, 10]])
         self.assertEqual(result['manufacturer'],  ['Microchip'])            
Beispiel #30
0
 def testSinglePage_ERJ2RKF3162X(self):
     if 1:
         from rs.core import Rs
         rs = Rs("ERJ-2RKF3162X",1,0)
         self.page = rs.getPage()
         with open("rs_ERJ-2RKF3162X.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse() 
         #print result
         self.assertEqual(result['minVPE'], [1])
         self.assertEqual(result['stock'], ['Nicht verfuegbar'] )
         self.assertEqual(result['supplier'], ['RS'])
         self.assertEqual(result['mpn'], ['ERJ-2RKF3162X'])            
         self.assertEqual(result['ausUSA'], [0])
         self.assertEqual(result['ordercode'],  ['871-9279'])
         self.assertEqual(result['prices'], [[154.50]])
         self.assertEqual(result['pricebreaks'], [[1]])
         self.assertEqual(result['manufacturer'],  ['Panasonic'])
Beispiel #31
0
 def testSinglePage_ERJ2RKF3162X(self):
     if 1:
         from rs.core import Rs
         rs = Rs("ERJ-2RKF3162X", 1, 0)
         self.page = rs.getPage()
         with open("rs_ERJ-2RKF3162X.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()
         #print result
         self.assertEqual(result['minVPE'], [1])
         self.assertEqual(result['stock'], ['Nicht verfuegbar'])
         self.assertEqual(result['supplier'], ['RS'])
         self.assertEqual(result['mpn'], ['ERJ-2RKF3162X'])
         self.assertEqual(result['ausUSA'], [0])
         self.assertEqual(result['ordercode'], ['871-9279'])
         self.assertEqual(result['prices'], [[154.50]])
         self.assertEqual(result['pricebreaks'], [[1]])
         self.assertEqual(result['manufacturer'], ['Panasonic'])
Beispiel #32
0
 def testSinglePage_FT230XS(self):
     if 1:
         from rs.core import Rs
         rs = Rs("FT230XS", 1, 0)
         self.page = rs.getPage()
         with open("rs_FT230XS.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()
         self.assertEqual(result['minVPE'], [10, 2])
         self.assertEqual(result['stock'], [-1, -1])
         #self.assertIn('Lieferbar' , result['stock'],[0,0])
         self.assertEqual(result['supplier'], ['RS', 'RS'])
         self.assertEqual(result['mpn'], ['FT230XS-U', 'FT230XS-R'])
         self.assertEqual(result['ausUSA'], [0, 0])
         self.assertEqual(result['ordercode'], ['888-8710', '757-0010'])
         self.assertEqual(result['prices'], [[1.515], [1.86]])
         self.assertEqual(result['pricebreaks'], [[10], [2]])
         self.assertEqual(result['manufacturer'],
                          ['FTDI Chip', 'FTDI Chip'])
Beispiel #33
0
 def testSinglePage_24AA16T_I_OT(self):
     if 1:
         from rs.core import Rs
         rs = Rs("24AA16T-I/OT", 1, 0)
         self.page = rs.getPage()
         with open("rs_24AA16T_I_OT.xml", "ab") as myfile:
             myfile.write(self.page)
         result = rs.parse()
         self.assertEqual(result['minVPE'], [1, 1, 26])
         self.assertEqual(result['stock'], [-1, -1, -1])
         self.assertEqual(result['supplier'], ['RS', 'RS', 'RS'])
         self.assertEqual(result['mpn'],
                          ['24AA16T-I/OT', '24AA16T-I/OT', '24AA16T-I/OT'])
         self.assertEqual(result['ausUSA'], [0, 0, 0])
         self.assertEqual(result['ordercode'],
                          ['687-9177', '687-9177P', '2509537378'])
         self.assertEqual(result['prices'], [[0.30], [0.30], [0.54]])
         self.assertEqual(result['pricebreaks'], [[1], [1], [26]])
         self.assertEqual(result['manufacturer'],
                          ['Microchip', 'Microchip', 'Microchip'])
Beispiel #34
0
    def doQuote(self, writePath):
        cnt = 0
        #exit();
        if 1:
            csvwriter = csv.writer(open(writePath,
                                        "w",
                                        newline='',
                                        encoding='utf-8'),
                                   delimiter="|",
                                   quotechar='"',
                                   quoting=csv.QUOTE_ALL)
            for intableItem in self.intable:
                #print(intableItem)
                cnt = cnt + 1
                if cnt < 0:
                    continue
                self.progressWriter.printMsg(intableItem['mpn'])
                self.progressWriter.setProgress(cnt, len(self.intable))
                #print str(cnt) + ' of '+str(len(self.intable))
                row = []
                row.append('0')
                row.append('orig')
                row.append(intableItem['qty'])
                row.append(intableItem['designator'])
                row.append(intableItem['mpn'])
                row.append(intableItem['manufacturer'])
                row.append(intableItem['description'])
                row.append(intableItem['footprint'])
                csvwriter.writerow(row)
                if 0:
                    rs = Rs(intableItem['mpn'], 1, 0)
                    self.progressWriter.printMsg(rs.getUrl())
                    result = rs.parse()
                    #result = rsParser.doRSQuote(intableItem['mpn'],1,1);

                    for i in range(len(result['ordercode'])):
                        #print i
                        #print len(result['ordercode'])
                        #print result
                        row = []
                        row.append('0')
                        row.append('RS')
                        row.append(0)
                        row.append(0)
                        row.append(result['ordercode'][i])
                        row.append(result['mpn'][i])
                        row.append(result['manufacturer'][i])
                        row.append(result['description'][i])
                        row.append(result['minVPE'][i])
                        row.append(result['pricebreaks'][i])
                        row.append(result['prices'][i])
                        row.append(result['stock'][i])
                        if result['ausUSA'][i]:
                            row.append('ausUSA')
                        else:
                            row.append('nichtAusUSA')
                        row.append(result['pku'][i])
                        row.append(result['URL'][i])
                        csvwriter.writerow(row)
                if 1:
                    farnell_api = Farnell_api(intableItem['mpn'], 1, 0)
                    self.progressWriter.printMsg(farnell_api.getUrl())
                    result = farnell_api.parse()
                    #if result['ausUSA']==[-1]:
                    #    farnell_api = farnell_api(intableItem['mpn']+'+'+intableItem['manufacturer'],1,0)
                    #    result = farnell_api.parse()

                    for i in range(len(result['ordercode'])):
                        addLine = 0
                        #print(result['ordercode'][i])
                        if self.excludeRLOrderNumbers == 0:
                            addLine = 1
                        else:
                            #print(result['ordercode'])
                            #print(i)
                            #print(result['ordercode'][i])
                            if (str(result['ordercode'][i]).find('RL') == -1):
                                addLine = 1
                            else:
                                pass
                        if self.maxMinVPE <= int(result['minVPE'][i]):
                            addLine = 0

                        if addLine:
                            row = []
                            row.append('0')
                            row.append('Farnell')
                            row.append(0)
                            row.append(0)
                            row.append(result['ordercode'][i])
                            row.append(result['mpn'][i])
                            row.append(result['manufacturer'][i])
                            row.append(result['description'][i])
                            row.append(result['minVPE'][i])
                            row.append(result['pricebreaks'][i])
                            row.append(result['prices'][i])
                            row.append(result['stock'][i])
                            #if cnt > 5:
                            #  exit()
                            if result['ausUSA'][i]:
                                row.append('ausUSA')
                            else:
                                row.append('nichtAusUSA')
                            row.append(result['pku'][i])
                            row.append(result['URL'][i])
                            csvwriter.writerow(row)
                if 1:
                    digikey__api = Digikey_api(intableItem['mpn'], 1, 0)
                    self.progressWriter.printMsg(digikey__api.getUrl())
                    result = digikey__api.parse()
                    #if result['ausUSA']==[-1]:
                    #    farnell_api = farnell_api(intableItem['mpn']+'+'+intableItem['manufacturer'],1,0)
                    #    result = farnell_api.parse()

                    for i in range(len(result['ordercode'])):
                        addLine = 1

                        if (str(result['stock'][i]).find('Reel') == -1):
                            addLine = 1
                        else:
                            addLine = 0

                        if self.maxMinVPE <= int(result['minVPE'][i]):
                            addLine = 0

                        if addLine:
                            row = []
                            row.append('0')
                            row.append('DigiKey')
                            row.append(0)
                            row.append(0)
                            row.append(result['ordercode'][i])
                            row.append(result['mpn'][i])
                            row.append(result['manufacturer'][i])
                            row.append(result['description'][i])
                            row.append(result['minVPE'][i])
                            row.append(result['pricebreaks'][i])
                            row.append(result['prices'][i])
                            row.append(result['stock'][i])
                            #if cnt > 5:
                            #  exit()
                            if result['ausUSA'][i]:
                                row.append('ausUSA')
                            else:
                                row.append('nichtAusUSA')
                            row.append(result['pku'][i])
                            row.append(result['URL'][i])
                            csvwriter.writerow(row)
                if 1:
                    mouser_api = Mouser_api(intableItem['mpn'], 1, 0)
                    self.progressWriter.printMsg(mouser_api.getUrl())
                    result = mouser_api.parse()
                    #if result['ausUSA']==[-1]:
                    #    farnell_api = farnell_api(intableItem['mpn']+'+'+intableItem['manufacturer'],1,0)
                    #    result = farnell_api.parse()

                    for i in range(len(result['ordercode'])):
                        addLine = 1

                        if (str(result['stock'][i]).find('Reel') == -1):
                            addLine = 1
                        else:
                            addLine = 0

                        if self.maxMinVPE <= int(result['minVPE'][i]):
                            addLine = 0

                        if addLine:
                            row = []
                            row.append('0')
                            row.append('Mouser')
                            row.append(0)
                            row.append(0)
                            row.append(result['ordercode'][i])
                            row.append(result['mpn'][i])
                            row.append(result['manufacturer'][i])
                            row.append(result['description'][i])
                            row.append(result['minVPE'][i])
                            row.append(result['pricebreaks'][i])
                            row.append(result['prices'][i])
                            row.append(result['stock'][i])
                            #if cnt > 5:
                            #  exit()
                            if result['ausUSA'][i]:
                                row.append('ausUSA')
                            else:
                                row.append('nichtAusUSA')
                            row.append(result['pku'][i])
                            row.append(result['URL'][i])
                            csvwriter.writerow(row)


#quote = Quote("..\\boms\\funksonde2\\sg04_btmodul\\bom.txt")
#quote.doQuote('..\\boms\\funksonde2\\sg04_btmodul\\bom_test.bomQuote')
Beispiel #35
0
    def doQuote(self,writePath):
        cnt = 0;
        #exit();
        if 1:
            csvwriter = csv.writer(open(writePath, "wb"), delimiter="|" , quotechar='"', quoting=csv.QUOTE_ALL)
            for intableItem in self.intable:
                #print(intableItem)
                cnt = cnt+1;
                if cnt < 0:
                    continue
                self.progressWriter.printMsg(intableItem['mpn'])
                self.progressWriter.setProgress(cnt,len(self.intable))
                #print str(cnt) + ' of '+str(len(self.intable))
                row = []
                row.append('0')
                row.append('orig')
                row.append(intableItem['qty'])
                row.append(intableItem['designator'])
                row.append(intableItem['mpn'])
                row.append(intableItem['manufacturer'])
                row.append(intableItem['description'])
                row.append(intableItem['footprint'])
                csvwriter.writerow(row)
                if 1:
                    rs = Rs(intableItem['mpn'],1,0)
                    self.progressWriter.printMsg(rs.getUrl())
                    result = rs.parse() 
                    #result = rsParser.doRSQuote(intableItem['mpn'],1,1);
            
                    for i in range(len(result['ordercode'])):
                        #print i
                        #print len(result['ordercode'])
                        #print result
                        row = []
                        row.append('0')
                        row.append('RS')
                        row.append(0)
                        row.append(0)    
                        row.append(result['ordercode'][i])
                        row.append(result['mpn'][i])
                        row.append(result['manufacturer'][i])
                        row.append(result['description'][i])
                        row.append(result['minVPE'][i])
                        row.append(result['pricebreaks'][i])
                        row.append(result['prices'][i])
                        row.append(result['stock'][i])
                        if result['ausUSA'][i]:
                            row.append('ausUSA')
                        else:
                            row.append('nichtAusUSA')
                        row.append(result['pku'][i])
                        row.append(result['URL'][i])
                        csvwriter.writerow(row)    
                if 1:
                    farnell_api = Farnell_api(intableItem['mpn'],1,0)
                    self.progressWriter.printMsg(farnell_api.getUrl())
                    result = farnell_api.parse()
                    #if result['ausUSA']==[-1]:
                    #    farnell_api = farnell_api(intableItem['mpn']+'+'+intableItem['manufacturer'],1,0)
                    #    result = farnell_api.parse()   
                    
                    for i in range(len(result['ordercode'])):
                        addLine=0; 
                        #print(result['ordercode'][i])
                        if self.excludeRLOrderNumbers == 0:
                            addLine=1;
                        else:
                            #print result['ordercode'][i].find('RL')
                            if (result['ordercode'][i].find('RL') == -1):
                                addLine=1;
                            else:
                                pass
                        if self.maxMinVPE <= int(result['minVPE'][i]):
                            addLine = 0

                        if addLine:
                            row = []
                            row.append('0')
                            row.append('Farnell')
                            row.append(0) 
                            row.append(0)
                            row.append(result['ordercode'][i])
                            row.append(result['mpn'][i])
                            row.append(result['manufacturer'][i])
                            row.append(result['description'][i])
                            row.append(result['minVPE'][i])
                            row.append(result['pricebreaks'][i])
                            row.append(result['prices'][i])
                            row.append(result['stock'][i])
                            #if cnt > 5:
                            #  exit()
                            if result['ausUSA'][i]:
                                row.append('ausUSA')
                            else:
                                row.append('nichtAusUSA')
                            row.append(result['pku'][i])
                            row.append(result['URL'][i])
                            csvwriter.writerow(row)    


        
        
#quote = Quote("..\\boms\\funksonde2\\sg04_btmodul\\bom.txt")
#quote.doQuote('..\\boms\\funksonde2\\sg04_btmodul\\bom_test.bomQuote')