mirror of
https://github.com/Mueller-Patrick/Betterzon.git
synced 2024-12-23 04:05:12 +00:00
Fixed string concatenation for sql statement in getProductLinksForProduct
This commit is contained in:
parent
776b9a00f2
commit
f98d1fdb24
|
@ -2,7 +2,6 @@ from flask import Flask
|
||||||
from flask_restful import Resource, Api, reqparse
|
from flask_restful import Resource, Api, reqparse
|
||||||
|
|
||||||
import crawler
|
import crawler
|
||||||
import sql
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
api = Api(app)
|
api = Api(app)
|
||||||
|
|
|
@ -35,7 +35,7 @@ def getProductsForVendor(vendor_id: int) -> [{}]:
|
||||||
conn = __getConnection__()
|
conn = __getConnection__()
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
|
|
||||||
query = 'SELECT product_id, url FROM product_links WHERE vendor_id = %s'
|
query = 'SELECT product_id, url FROM product_links WHERE vendor_id = %s' % vendor_id
|
||||||
|
|
||||||
cur.execute(query, (vendor_id,))
|
cur.execute(query, (vendor_id,))
|
||||||
|
|
||||||
|
@ -53,8 +53,8 @@ def getProductLinksForProduct(product_id: int) -> [dict]:
|
||||||
conn = __getConnection__()
|
conn = __getConnection__()
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
|
|
||||||
query = 'SELECT vendor_id, url FROM product_links WHERE product_id = %s'
|
query = 'SELECT vendor_id, url FROM product_links WHERE product_id = %s' % product_id
|
||||||
|
print(query)
|
||||||
cur.execute(query, (product_id,))
|
cur.execute(query, (product_id,))
|
||||||
|
|
||||||
products = list(map(lambda x: {'product_id': product_id, 'vendor_id': x[0], 'url': x[1]}, cur.fetchall()))
|
products = list(map(lambda x: {'product_id': product_id, 'vendor_id': x[0], 'url': x[1]}, cur.fetchall()))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user