@@ -26,7 +26,7 @@ def main():
26
26
# We can only process so many part numbers at a time
27
27
partNumberBatches = list (chunks (arguments , MAX_QUERY_ITEMS ))
28
28
29
- retultsTable = ""
29
+ resultsTable = ""
30
30
31
31
for partNumbers in partNumberBatches :
32
32
# Build a query for the Octopart API
@@ -64,7 +64,7 @@ def main():
64
64
65
65
for idx , result in enumerate (response ['results' ]):
66
66
if len (result ['items' ]) == 0 :
67
- retultsTable += "%s \t No results found \n " % partNumbers [idx ]
67
+ resultsTable += "%s \t No results found \n " % partNumbers [idx ]
68
68
continue
69
69
70
70
quotes = [] # [[quantity, unitPrice], ...]
@@ -80,16 +80,16 @@ def main():
80
80
print "Seller: %s" % item ['offers' ][0 ]['seller' ]['name' ]
81
81
quotes .sort (key = lambda x : x ['price' ]) # find lowest price
82
82
if quantity >= 1000 :
83
- retultsTable += "%s \t $%s \t @ \t %sk \n " % (quotes [0 ]['mpn' ], quotes [0 ]['price' ], quotes [0 ]['quantity' ]/ 1000 )
83
+ resultsTable += "%s \t $%s \t @ \t %sk \n " % (quotes [0 ]['mpn' ], quotes [0 ]['price' ], quotes [0 ]['quantity' ]/ 1000 )
84
84
else :
85
- retultsTable += "%s \t $%s \t @ \t %s \n " % (quotes [0 ]['mpn' ], quotes [0 ]['price' ], quotes [0 ]['quantity' ])
85
+ resultsTable += "%s \t $%s \t @ \t %s \n " % (quotes [0 ]['mpn' ], quotes [0 ]['price' ], quotes [0 ]['quantity' ])
86
86
87
- print retultsTable
87
+ print resultsTable
88
88
89
89
def chunks (l , n ):
90
90
"""Yield successive n-sized chunks from l."""
91
91
for i in range (0 , len (l ), n ):
92
92
yield l [i :i + n ]
93
93
94
94
if __name__ == '__main__' :
95
- main ()
95
+ main ()
0 commit comments