浏览代码

Product bean used to process raw data

Jovian (Toshiba) 6 年之前
父节点
当前提交
566e8be726
共有 2 个文件被更改,包括 7 次插入1 次删除
  1. 4 1
      app_dispatcher.py
  2. 3 0
      model/product.py

+ 4 - 1
app_dispatcher.py

@@ -1,5 +1,6 @@
 from consumer.connect import DataConsumer
 from consumer.credentials import getCredentials
+from model.product import Product
 
 print('Start')
 
@@ -9,6 +10,8 @@ consumer = DataConsumer(credentials)
 rows = consumer.getProductSet()
 
 for r in rows:
-	print(r)
+        pro = Product(r)
+        print('id = ', pro.id, '; name = ', pro.name)
+        print('- - -')
 
 print('End')

+ 3 - 0
model/product.py

@@ -0,0 +1,3 @@
+class Product():
+    def __init__(self, raw):
+        (self.id, self.name) = raw