raena-crawler-engine/amazon_crawler_engine/test_db.py

78 lines
2.9 KiB
Python
Raw Normal View History

2024-01-24 13:05:07 +00:00
import hashlib
from amazon_db_writer import amazon_db_writer
config = {
"crawler_name": "raena_crawler_enginer_amazon",
"crawler_schema": "raena_spider_management",
"category_tab": "rce_category",
"tracker_tab": "crawler_tracker",
"product_tab": "rce_product",
"variant_tab": "rce_product_variant",
"brand_tab": "rce_brand",
"reseller_tab": "rce_reseller",
"reseller_store_tab": "rce_reseller_store",
"review_tab": "rce_ratings_reviews",
"review_productmodels_tab": "rce_ratings_reviews_productmodels",
"review_producttags_tab": "rce_ratings_reviews_producttags",
"review_tags": "rce_tags",
"source_tab": "rce_source",
"product_per_category": "1000",
"source_category": "11043145",
"db_user": "postgres",
"db_pass": "postgres",
"database": "postgres",
"db_host": "localhost",
"db_port": "5444",
"crawler_main": "1",
"crawler_slave_no": ""
}
db_writer = amazon_db_writer(config)
data_product = {}
data_product['rce_source_product_id'] = 0
data_product['rce_source_id'] = 1
data_product['rce_source_product_status'] = 1
data_product['product_page_url'] = 'https://www.amazon.ae/Davidoff-Water-Perfume-Toilette-110ML/dp/B002S8PT8U/?_encoding=UTF8&pd_rd_w=VQ6dh&content-id=amzn1.sym.baa1fbbd-9373-444b-8104-61fa134741c5%3Aamzn1.symc.36bd837a-d66d-47d1-8457-ffe9a9f3ddab&pf_rd_p=baa1fbbd-9373-444b-8104-61fa134741c5&pf_rd_r=6EKKA9QC40Y5MFKGRWYQ&pd_rd_wg=nsmjm&pd_rd_r=6d02ccd2-297c-4b73-8586-a9ac9b355d4a&ref_=pd_gw_ci_mcx_mr_hp_atf_m'
data_product['product_page_url_hash'] = 'bjhgfds867ty3iuhbfew'
data_product['rce_category_id'] = 3
data_product['rce_brand_id'] = 2
data_product['rce_store_id'] = 6
data_product['rce_source_product_name'] = "Hot Water by Davidoff for Men"
data_product['product_images'] = ""
data_product['product_description'] = "Davidoff Hot Water hits you first with its fresh spicy aroma owing to the vegetal top notes of wormwood and basil. While the o"
data_product['product_sold_total'] = 0
data_product['product_sold'] = 0
data_product['product_price_min'] = "99.00"
data_product['product_price_min_before_discount'] ="340.00"
data_product['product_price_max'] = "99.00"
data_product['product_price_max_before_discount'] = "340.00"
data_product['ratings'] = 4.1
data_product['product_section'] = "Fragrance"
data_variant = {}
data_variant['rce_source_variant_id'] = 0
data_variant['rce_product_id'] = 2
data_variant['product_variant_name'] = "abc"
data_variant['product_variant_price'] = "67.3"
data_variant['product_variant_price_before_discount'] = "100.90"
data_variant['product_variant_stock'] = 0
data_review = {}
data_review["id"] = 1
data_review["rce_product_id"] = 5
data_review["username"] = "adnan"
data_review["review"] = "very good product"
data_review["img_url"] = ""
data_review["review_like_count"] = 0
data_review["user_tier"] = ""
data_review["shop_id"] = 2
data_review["video_url"] = ""
data_review["rating"] = "4.9"
db_writer.rce_ratings_reviews(data_review)