REDROOM
PHP 7.4.33
Path:
Logout
Edit File
Size: 2.86 KB
Close
//python-scripts-home/README.md
Text
Base64
# Quicklly Google Merchant Product Upload This project automates the upload and deletion of products to Quicklly’s Google Merchant Center using the Content API. --- ## 📁 Project Structure ``` Google Merchant Product Upload/ ├── merchant_upload.py ├── requirements.txt ├── README.md ├── handoff.pdf ├── keys/ │ └── quicklly-merchant-center.json ├── tools └── delete_all_products.py └── delete_select_products.py ``` --- ## Setup Instructions ### 1. Create a Virtual Environment (Optional but Recommended) ```bash python3 -m venv env source env/bin/activate ``` ### 2. Install Dependencies ```bash pip install -r requirements.txt ``` --- ## Credentials Setup Place the provided **`quicklly-merchant-center.json`** file in: ```bash ./keys/quicklly-merchant-center.json ``` Make sure this matches the path in your script: ```python SERVICE_ACCOUNT_FILE = './keys/quicklly-merchant-center.json' ``` --- ## Running the Script ```bash python merchant_upload.py ``` --- ## Deleting Products Delete a single product by offerId Use this to quickly remove an individual product from Google Merchant Center: ```bash python tools/delete_product.py <offerId> ``` Delete all products (use with caution!) Wipes the entire product catalog. Use only for staging/testing environments or after confirmation: ```bash python tools/delete_all_products.py ``` ## Automating with Cron ### Every 2 Minutes ```bash */2 * * * * /usr/bin/python3 /path/to/Google\ Merchant\ Product\ Upload/merchant_upload.py >> /var/log/merchant_upload.log 2>&1 ``` ### Every 2 Hours ```bash 0 */2 * * * /usr/bin/python3 /path/to/Google\ Merchant\ Product\ Upload/merchant_upload.py >> /var/log/merchant_upload.log 2>&1 ``` > Ensure proper file permissions and review log output regularly. --- ## Regional Inventory Mapping The script automatically assigns products to predefined regions based on the product’s `"city"` field using a dictionary like: ```python CITY_TO_REGION_ID = { "chicago": "region_chi", "new york": "region_nyc", "los angeles": "region_la", "san francisco": "region_sf" } ``` If a product’s city doesn’t match this mapping, no regional inventory will be sent. --- ## How to Expand to Hundreds of Regions 1. In Google Merchant Center, go to: ``` Products → Regional availability and pricing → Region definitions ``` 2. Create new regions with: - A **region ID** (at least 6 characters, e.g., `region_dallas`) - A large enough set of ZIP codes (30–100+ per region is recommended) 3. Update your script's mapping: ```python CITY_TO_REGION_ID["dallas"] = "region_dallas" ``` For large-scale rollout, this mapping can also be loaded from a CSV, database, or admin panel. --- ## Notes - **Merchant ID:** `5616033984` - **API Scope:** `https://www.googleapis.com/auth/content` - **Region:** `US`
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 4 × Files: 4
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
keys
DIR
-
drwxr-xr-x
2025-07-22 17:20:04
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
logs
DIR
-
drwxr-xr-x
2025-07-22 18:23:22
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
region_mappings
DIR
-
drwxr-xr-x
2025-07-31 17:00:29
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
tools
DIR
-
drwxr-xr-x
2025-07-31 17:01:47
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
merchant_upload.py
10.65 KB
lrw-r--r--
2025-07-31 17:03:46
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
merchant_upload.sh
127 B
lrwxrwxrwx
2025-07-23 16:56:47
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
README.md
2.86 KB
lrw-r--r--
2025-07-22 17:19:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
requirements.txt
46 B
lrw-r--r--
2025-07-22 17:19:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).