<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: orhansavash</title>
    <description>The latest articles on DEV Community by orhansavash (@orhansavash).</description>
    <link>https://dev.to/orhansavash</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4256215%2F682d29cb-006d-4532-8543-c55d2a8fc740.jpg</url>
      <title>DEV Community: orhansavash</title>
      <link>https://dev.to/orhansavash</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/orhansavash"/>
    <language>en</language>
    <item>
      <title>US import duty from Python: every tariff layer for an HTS code, free (pip install zentria-flow)</title>
      <dc:creator>orhansavash</dc:creator>
      <pubDate>Fri, 20 Nov 2026 18:16:18 +0000</pubDate>
      <link>https://dev.to/orhansavash/us-import-duty-from-python-every-tariff-layer-for-an-hts-code-free-pip-install-zentria-flow-2mmm</link>
      <guid>https://dev.to/orhansavash/us-import-duty-from-python-every-tariff-layer-for-an-hts-code-free-pip-install-zentria-flow-2mmm</guid>
      <description>&lt;p&gt;If you sell physical products into the US, "what is the duty on this?" stopped having one answer. A cotton T-shirt from China doesn't pay its 16.5% MFN rate. It pays 36.5%, because two more tariffs sit on top. Christmas lights from China pay 45.5%; the same lights from Vietnam pay 20.5%.&lt;/p&gt;

&lt;p&gt;Spreadsheets get this wrong because the layers come from different legal programs, each with its own exemptions and dates. So we put our tariff engine behind a free API and wrapped it in a small Python package.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install zentria-flow
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No key, no account, no dependencies (standard library only).&lt;/p&gt;

&lt;h2&gt;
  
  
  One line, every layer
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ zentria-flow check 9405.31.00 CN
HTS 9405.31.00 from CN  &lt;span class="o"&gt;(&lt;/span&gt;entry date 2026-11-20&lt;span class="o"&gt;)&lt;/span&gt;
  Luminaires and lighting fittings ... not elsewhere specified or included
  MFN duty                                8%
  Section 301                            25%  &lt;span class="o"&gt;(&lt;/span&gt;List 3&lt;span class="o"&gt;)&lt;/span&gt;
  Forced-labor Section 301 tariff      12.5%  &lt;span class="o"&gt;(&lt;/span&gt;applies&lt;span class="o"&gt;)&lt;/span&gt;
  Section 232                             0%
  Section 338 &lt;span class="o"&gt;(&lt;/span&gt;Canada&lt;span class="o"&gt;)&lt;/span&gt;                    0%
  Total US duty                        45.5%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Same thing in Python:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;zentriaflow&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Client&lt;/span&gt;

&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tariff_check&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"6109.10.00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"CN"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# cotton T-shirt&lt;/span&gt;
&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;total_rate&lt;/span&gt;                              &lt;span class="c1"&gt;# 36.5&lt;/span&gt;
&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"label"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"rate"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;l&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;layers&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="c1"&gt;# [('MFN duty', 16.5), ('Section 301', 7.5), ('Forced-labor Section 301 tariff', 12.5),&lt;/span&gt;
&lt;span class="c1"&gt;#  ('Section 232', 0.0), ('Section 338 (Canada)', 0.0)]&lt;/span&gt;
&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;duty&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;12_000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;                            &lt;span class="c1"&gt;# 4380.0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Rates have dates
&lt;/h2&gt;

&lt;p&gt;US duty is set on the day goods are &lt;em&gt;entered&lt;/em&gt;, not ordered. Kitchen cabinets from Vietnam pay 25% today and 50% from 1 January 2027 (Section 232 on wood products). Pass an entry date to see it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ zentria-flow check 9403.40.9060 VN --as-of 2027-01-02
  ...
  Section 232                            50%
  Total US duty                          50%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every answer also carries &lt;code&gt;scheduled_changes&lt;/code&gt;: the changes already dated for that line, with the rate before and after. &lt;code&gt;zentria-flow calendar --origin VN&lt;/code&gt; lists every dated change that hits an origin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Moving a supplier? Compare first
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ zentria-flow compare 9503.00.00 CN VN
HTS 9503.00.00, total US duty, lowest first:
  CN     12.5%
  VN     12.5%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Toys: the China Section 301 tariff on this line is suspended, so what is left is the forced-labor tariff, the same 12.5% for both. Moving toy production from China to Vietnam saves nothing on US duty.&lt;/p&gt;

&lt;h2&gt;
  
  
  A whole product list
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ cat products.csv
hts,origin,value
9405.31.00,CN,20000
9405.31.00,VN,20000
9505.10.25,CN,8000
$ zentria-flow price products.csv &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; priced.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each row gets &lt;code&gt;total_rate&lt;/code&gt;, &lt;code&gt;duty&lt;/code&gt; and &lt;code&gt;next_change&lt;/code&gt;. In Python it is &lt;code&gt;c.price_rows(rows)&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits and honesty
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The free API allows about 60 tariff checks an hour per IP. &lt;code&gt;Client(wait_on_limit=True)&lt;/code&gt; waits and retries once.&lt;/li&gt;
&lt;li&gt;Answers are planning estimates, not customs rulings. Anti-dumping and countervailing duties are company-specific and are not in any total.&lt;/li&gt;
&lt;li&gt;Classification is the importer's job; &lt;code&gt;zentria-flow search "christmas lights"&lt;/code&gt; lists candidate HTS lines, it doesn't pick one for you.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The package is MIT licensed: &lt;a href="https://github.com/orhansavash/zentria-flow-python" rel="noopener noreferrer"&gt;github.com/orhansavash/zentria-flow-python&lt;/a&gt;, on PyPI as &lt;a href="https://pypi.org/project/zentria-flow/" rel="noopener noreferrer"&gt;zentria-flow&lt;/a&gt;. The same engine is in Google Sheets (&lt;code&gt;=ZF_DUTY("6109.10.00","China")&lt;/code&gt;), in an MCP server for Claude, and on the web at &lt;a href="https://zentriaflow.com" rel="noopener noreferrer"&gt;zentriaflow.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Which product should we check next? Leave an HTS code and a country in the comments.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Drafted with AI assistance; every command above was re-run against the live package on 20 Nov 2026.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>opensource</category>
      <category>ecommerce</category>
      <category>api</category>
    </item>
  </channel>
</rss>
