Supplier catalog sync is the job of keeping a supplier's product, price and stock data in line with the records in your store, on a regular schedule. The data comes from a product feed, a B2B API or a reseller portal. Each product is matched by SKU or barcode, and only the changed rows are written to the store. The trap is the bulk update: a single price with a shifted decimal point can spread across the whole catalog. This post covers data sources, diff logic, threshold guards and the role of a proxy in this work.
Data sources
The first rule of syncing is to use the supplier's official channel. Most suppliers give their resellers data in one of four ways. Ask the supplier's reseller team which one is open before you write any code.
| Source | Format | Note |
|---|---|---|
| Product feed | XML or CSV at a fixed URL | Most common, usually refreshed a few times a day |
| B2B API | JSON, with a key or token | Freshest stock data, may have a request limit |
| FTP / SFTP file | CSV or Excel dropped overnight | Full list, no intraday changes |
| Reseller portal | Web pages behind your own login | Only if the first three are missing |
The reseller portal is the last option. If you pull data from a portal, use your own reseller account and follow the portal's terms and robots.txt rules. Keep requests slow and ask the supplier for permission first. Most suppliers open a feed URL for a reseller once asked.
Whatever the source, store the incoming file as it is first. The raw file is the only way back after a bad update.
SKU and barcode matching
Matching links the supplier's product to the product in your store through a shared key. There are two candidates: the supplier's stock code (SKU) and the product's barcode (GTIN). The SKU belongs to the supplier. The GTIN belongs to the product itself and has 8, 12, 13 or 14 digits.
If you buy the same product from several suppliers, the GTIN is the safer key. With a single supplier the SKU is enough. Either way, store the key as text. If a barcode is read as a number, the zeros at its start drop and matching breaks silently. A CSV opened and saved in Excel is the most common source of this error.
The supplier's field names will not match yours. Mapping the price_excl_vat field to your store's price field is a separate task. The method for building field mappings is in our post What Is Data Mapping?. This post focuses on the price and stock fields only.
Diff logic
Diffing compares the new feed with the previous copy and finds only the rows that changed. Rewriting the whole catalog to the store in every run creates needless load. You hit the store platform's API limit and cannot see which products really changed.
The comparison produces three sets:
- Added: keys in the new feed that are missing from the old copy. These should enter the store as drafts, not go straight live.
- Removed: keys in the old copy that are missing from the new feed. Setting stock to zero and hiding the product is safer than deleting it.
- Changed: keys on both sides with a different price or stock. This is the main load of the sync.
Watch the removed set closely. A half-downloaded file makes thousands of products look "removed". If the feed suddenly shrank, the problem is in the download, not the catalog.
Price and stock frequency
Price and stock change at different speeds, so they update on separate schedules. Stock moves often during the day and affects sales directly: sell an item that is out of stock and you have to cancel the order. Price changes less often, but a price error costs more.
A common setup looks like this:
| Job | When | Scope |
|---|---|---|
| Full comparison | Overnight, when traffic is low | The whole catalog, including added and removed |
| Stock diff | During the day, at the feed's refresh rate | Stock field only |
| Price diff | Once or twice a day | Price field only, with a threshold check |
Pulling the feed more often than the supplier refreshes it gains nothing. Read the feed's last change time from the HTTP Last-Modified header or from a date field in the file. If nothing changed, skip the run.
Threshold guard
A threshold guard is a check that halts the bulk update when it sees an unusual change. If the decimal point shifts in the supplier's file, a product at 12.99 USD becomes 129.90 USD. If it shifts the other way, the product sells at a loss. The check catches these rows before they reach the store.
The example in this post uses two thresholds. They are sample values, so pick your own for your catalog:
- If a product's price changes by more than 20%, the update halts.
- If more than 20% of products appear removed, the update halts.
Halting does not mean doing nothing. You can apply the stock updates that stay under the threshold and hold back only the price batch. Rows over the threshold should go to a person for approval. Sending the alert to email or a chat channel is enough.
Comparing catalogs in Python
The function below compares two CSV files by key and returns the three sets plus the threshold breaches. Prices are calculated with Decimal, because float does not store decimal amounts exactly.
import csv
from decimal import Decimal
PRICE_THRESHOLD = Decimal("0.20") # sample threshold: halt if a price changes by more than 20%
REMOVAL_THRESHOLD = 0.20 # sample threshold: halt if more than 20% of products are removed
def load(path, key):
with open(path, newline="", encoding="utf-8") as f:
return {r[key].strip(): r for r in csv.DictReader(f)}
def compare(old_path, new_path, key="sku"):
old, new = load(old_path, key), load(new_path, key)
added = sorted(new.keys() - old.keys())
removed = sorted(old.keys() - new.keys())
changed, over_threshold = [], []
for sku in sorted(old.keys() & new.keys()):
o, n = old[sku], new[sku]
diff = {f: (o[f], n[f]) for f in ("price", "stock") if o[f] != n[f]}
if not diff:
continue
changed.append((sku, diff))
if "price" in diff:
before, after = Decimal(o["price"]), Decimal(n["price"])
if before and abs(after - before) / before > PRICE_THRESHOLD:
over_threshold.append((sku, before, after))
halt = bool(over_threshold) or len(removed) > len(old) * REMOVAL_THRESHOLD
return added, removed, changed, over_threshold, halt
if __name__ == "__main__":
added, removed, changed, over, halt = compare("yesterday.csv", "today.csv")
print("Added:", added)
print("Removed:", removed)
for sku, diff in changed:
print("Changed:", sku, diff)
for sku, before, after in over:
print(f"Threshold exceeded: {sku} {before} -> {after}")
print("Bulk update halted" if halt else "Update can be applied")In the sample data, yesterday.csv holds six products. In today.csv, one product was added, one dropped out, one price rose by 3% and one price had its decimal point shifted. Output:
Added: ['ADP-200']
Removed: ['KLF-101']
Changed: KBL-001 {'price': ('149.90', '154.90')}
Changed: KBL-002 {'stock': ('40', '35')}
Changed: SRJ-010 {'price': ('1299.00', '12990.00')}
Changed: SRJ-011 {'stock': ('0', '14')}
Threshold exceeded: SRJ-010 1299.00 -> 12990.00
Bulk update haltedSRJ-010, whose price jumped tenfold, halted the batch. Calling the same function with key="gtin" matches on barcode instead. When we tried a file with only two rows downloaded, four products looked removed and the removal threshold halted the batch.
The role of a proxy
If you use an official feed or API, you usually do not need a proxy. A proxy helps in two cases, and both are about access conditions.
The first is an IP allowlist. Some suppliers open the feed URL or B2B API only to registered IPs. If the sync runs on a cloud server or a line with a dynamic IP, the outgoing address changes and the request is refused. We explained how allowlists work in Static IP for API Access. For an outgoing address that does not change, you can use a ISP Proxy and give that IP to the supplier.
The second is a country-dependent view. On most reseller portals the price list is tied to the account. Some portals, though, pick the price, currency or warehouse stock based on the visitor's country. We covered why prices vary by location in Why Do Prices Differ by Country?. If your store sells into another country, pulling the data as seen from that country gives you the terms your customer will see.
Downloading the feed through a proxy is one parameter in Requests:
import requests
PROXY = "http://user:pass@pr.proxynet.io:8000"
FEED_URL = "https://supplier.example/feed/products.csv"
r = requests.get(FEED_URL, proxies={"http": PROXY, "https": PROXY}, timeout=30)
r.raise_for_status()
with open("today.csv", "wb") as f:
f.write(r.content)A proxy is not used to get around a request limit the supplier has set. If the feed refreshes once an hour, one request an hour is enough.
Debugging
Sync errors are mostly silent: the code runs, but it writes the wrong data. These symptoms come up often.
- Every product shows as "changed" in every run: the supplier may have changed its number format (
149.9vs149.90). Normalize prices withDecimalbefore comparing them. - No barcode matches: the zeros at the start dropped or the cell turned into scientific notation (
8.69E+12). Read the key as text. - Accented characters are garbled: the file may use a legacy Windows code page (such as Windows-1252) instead of UTF-8. Set the
encodingparameter to the supplier's encoding. - The removed count suddenly spiked: the file was only half downloaded. Compare the downloaded size with
Content-Length. - The feed returns
403: the IP your request leaves from is not on the allowlist. Check your outgoing address.
How we tested
We ran the examples on 2026-12-02 on Windows 11 with Python 3.13.17 and Requests 2.34.2. We tried the comparison function with two six-product CSV files, with a file cut off after two rows and with the gtin key. We pointed the download example at an http:// test feed through a local HTTP proxy that logged incoming requests. The proxy received the Proxy-Authorization: Basic header, and the downloaded file matched the source.
The bottom line
Use the official feed, match products on a single key and push only the diff. Update stock often and price with a threshold check. A proxy comes in only when you need an IP allowlist or a country view. The options for those cases are on the e-commerce proxy page. Above all, never run a bulk price update without a threshold check.
Sources
- GTIN [gtin], Google Merchant Center Help: support.google.com
- RFC 4180, Common Format and MIME Type for CSV Files: rfc-editor.org
- csv — CSV File Reading and Writing, Python documentation: docs.python.org
- decimal — Decimal fixed-point arithmetic, Python documentation: docs.python.org
Frequently asked questions
Should I use a supplier's XML feed or its API?
The API suits stock, the feed suits the catalog. An API gives live data but usually has a request limit. An XML or CSV feed brings the whole catalog in one file and fits the overnight full comparison. If both are open, a common setup takes new products from the feed and intraday stock changes from the API.
Should I match products by SKU or by barcode?
With one supplier the SKU is enough; with several, the barcode (GTIN) is safer. The SKU belongs to the supplier, so the same product arrives under different codes from two suppliers. The GTIN belongs to the product itself. Always store the barcode as text, because read as a number it loses the zeros at its start. Write unmatched rows to a separate list and check them by hand.
How often should stock be updated?
As often as the supplier's feed refreshes. Pulling the feed more often brings no new data, only needless requests. Read the feed's last change time from the Last-Modified header and skip the run if nothing changed. For fast-selling products, if an API is available, taking stock from it at shorter intervals makes sense.
What should the price threshold be?
There is no single right value; you pick it for your catalog. The 20% in this post is only an example. For electronics, where prices change often, you can set a wider threshold, and a narrower one for products with stable prices. What matters is that a row over the threshold goes to a person for approval before it reaches the store. Watch the alerts in the first weeks and tune the threshold to real changes.
Do I need a proxy for supplier sync?
No, in most cases you do not. Official feeds and APIs work directly. A proxy helps in two cases. If the supplier opens access only to registered IPs, it gives you a fixed outgoing address. If the portal shows price or stock based on the visitor's country, it gives you that country's view. Without these two conditions a direct connection is enough.
Should removed products be deleted from the store?
No, hide them first. The product may have dropped out of the feed temporarily, or the file may have been half downloaded. Setting stock to zero and unpublishing the product keeps the page's URL and history. If the product does not come back after a few full comparison runs, you can decide to remove it for good. Make that call once the supplier confirms the product is off the list.




