tarifftrust 0.2.0__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: tarifftrust
3
- Version: 0.2.0
3
+ Version: 0.3.1
4
4
  Summary: Official Python client for the TariffTrust API: every US import duty and fee for an HTS code, an origin and a value, each with its official source.
5
5
  Project-URL: Homepage, https://tarifftrust.com/api/
6
6
  Project-URL: Documentation, https://tarifftrust.com/api/reference/
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tarifftrust"
3
- version = "0.2.0"
3
+ version = "0.3.1"
4
4
  description = "Official Python client for the TariffTrust API: every US import duty and fee for an HTS code, an origin and a value, each with its official source."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -107,7 +107,8 @@ class Operations:
107
107
  An informal entry pays a fixed fee the estimate does not calculate: it gives no
108
108
  fees.
109
109
  facts: Answers to the questions of the facts catalogue (GET /v2/facts), by name. A
110
- name outside the catalogue is said in warnings and never used.
110
+ name that is no question is refused, so that a typing error never gives a figure
111
+ on the ordinary case.
111
112
  freight: International freight in US dollars: no duty on it, it adds to the landed
112
113
  cost.
113
114
  include_fees: Count the entry fees (MPF, HMF) of a declaration of this product
@@ -121,8 +122,10 @@ class Operations:
121
122
  for KORUS…; GET /v2/agreements). Giving it declares that the goods meet its
122
123
  rules of origin and that you hold the proof.
123
124
  publication_id: Calculate with this publication of the rules instead of the one in
124
- service on that date: the data.publication_id of an earlier answer gives the
125
- same result again, as long as the engine has not changed.
125
+ service on that date: the data.publication_id of an earlier answer gives its
126
+ rates and rules again, as long as the engine has not changed. What withholds an
127
+ estimate today (an incident, an official notice not yet read, an exclusion from
128
+ importation) still applies: a saved estimate alone keeps its result.
126
129
  quantities: Quantities in the units a duty counts (kg, l, item, dozen, pair,
127
130
  proof_liter…), nonnegative. An answer names the quantity it needs in missing
128
131
  ("quantities.kg").
@@ -167,8 +170,10 @@ class Operations:
167
170
  Args:
168
171
  items: The products, each calculated on its own.
169
172
  publication_id: Calculate with this publication of the rules instead of the one in
170
- service on that date: the data.publication_id of an earlier answer gives the
171
- same result again, as long as the engine has not changed.
173
+ service on that date: the data.publication_id of an earlier answer gives its
174
+ rates and rules again, as long as the engine has not changed. What withholds an
175
+ estimate today (an incident, an official notice not yet read, an exclusion from
176
+ importation) still applies: a saved estimate alone keeps its result.
172
177
  idempotency_key: Makes a retry of this call safe; a new one is generated for each
173
178
  call otherwise.
174
179
  """
@@ -213,8 +218,9 @@ class Operations:
213
218
  entry_type: A formal entry pays the merchandise processing fee (MPF) on its value.
214
219
  An informal entry pays a fixed fee the estimate does not calculate: it gives no
215
220
  fees.
216
- facts: Answers that hold for the whole declaration (GET /v2/facts, scope entry or
217
- shipment).
221
+ facts: Answers that hold for every line of the declaration, by name (GET /v2/facts):
222
+ a line's own answer comes first. Given here, mpf_exempt holds for the lines
223
+ entered under an agreement, and hmf_exempt for the declaration.
218
224
  freight: International freight in US dollars: no duty on it, it adds to the landed
219
225
  cost.
220
226
  include_fees: Count the entry fees (MPF, HMF) of the declaration.
@@ -222,8 +228,10 @@ class Operations:
222
228
  landed cost.
223
229
  label: A name for the saved estimate; needs save.
224
230
  publication_id: Calculate with this publication of the rules instead of the one in
225
- service on that date: the data.publication_id of an earlier answer gives the
226
- same result again, as long as the engine has not changed.
231
+ service on that date: the data.publication_id of an earlier answer gives its
232
+ rates and rules again, as long as the engine has not changed. What withholds an
233
+ estimate today (an incident, an official notice not yet read, an exclusion from
234
+ importation) still applies: a saved estimate alone keeps its result.
227
235
  reference: Your reference for the declaration.
228
236
  save: Save the estimate: only a saved estimate keeps its detail, is reported, and is
229
237
  notified if a rate proves wrong. An answer without a figure is not saved. Send
@@ -282,7 +290,8 @@ class Operations:
282
290
  An informal entry pays a fixed fee the estimate does not calculate: it gives no
283
291
  fees.
284
292
  facts: Answers to the questions of the facts catalogue (GET /v2/facts), by name. A
285
- name outside the catalogue is said in warnings and never used.
293
+ name that is no question is refused, so that a typing error never gives a figure
294
+ on the ordinary case.
286
295
  freight: International freight in US dollars: no duty on it, it adds to the landed
287
296
  cost.
288
297
  from_: First day of the period. Unset: the first edition the service holds.
@@ -318,10 +327,10 @@ class Operations:
318
327
  ) -> FactList:
319
328
  """List the questions an estimate may ask.
320
329
 
321
- The facts catalogue: each question a measure may depend on, by the name to answer it
322
- with in facts, its type, its choices and its ordinary case. An answer names the ones it
323
- needs in missing, and those it rests on in facts. Needs the read permission; not
324
- counted.
330
+ The questions that can change an answer today: each by the name to answer it with in
331
+ facts, its type, its choices and its ordinary case. An answer names the ones it needs in
332
+ missing, and those it rests on in facts. The example shows two of them; the answer lists
333
+ them all. Needs the read permission; not counted.
325
334
  """
326
335
  return self._request(
327
336
  "GET",
@@ -510,7 +519,8 @@ class AsyncOperations:
510
519
  An informal entry pays a fixed fee the estimate does not calculate: it gives no
511
520
  fees.
512
521
  facts: Answers to the questions of the facts catalogue (GET /v2/facts), by name. A
513
- name outside the catalogue is said in warnings and never used.
522
+ name that is no question is refused, so that a typing error never gives a figure
523
+ on the ordinary case.
514
524
  freight: International freight in US dollars: no duty on it, it adds to the landed
515
525
  cost.
516
526
  include_fees: Count the entry fees (MPF, HMF) of a declaration of this product
@@ -524,8 +534,10 @@ class AsyncOperations:
524
534
  for KORUS…; GET /v2/agreements). Giving it declares that the goods meet its
525
535
  rules of origin and that you hold the proof.
526
536
  publication_id: Calculate with this publication of the rules instead of the one in
527
- service on that date: the data.publication_id of an earlier answer gives the
528
- same result again, as long as the engine has not changed.
537
+ service on that date: the data.publication_id of an earlier answer gives its
538
+ rates and rules again, as long as the engine has not changed. What withholds an
539
+ estimate today (an incident, an official notice not yet read, an exclusion from
540
+ importation) still applies: a saved estimate alone keeps its result.
529
541
  quantities: Quantities in the units a duty counts (kg, l, item, dozen, pair,
530
542
  proof_liter…), nonnegative. An answer names the quantity it needs in missing
531
543
  ("quantities.kg").
@@ -570,8 +582,10 @@ class AsyncOperations:
570
582
  Args:
571
583
  items: The products, each calculated on its own.
572
584
  publication_id: Calculate with this publication of the rules instead of the one in
573
- service on that date: the data.publication_id of an earlier answer gives the
574
- same result again, as long as the engine has not changed.
585
+ service on that date: the data.publication_id of an earlier answer gives its
586
+ rates and rules again, as long as the engine has not changed. What withholds an
587
+ estimate today (an incident, an official notice not yet read, an exclusion from
588
+ importation) still applies: a saved estimate alone keeps its result.
575
589
  idempotency_key: Makes a retry of this call safe; a new one is generated for each
576
590
  call otherwise.
577
591
  """
@@ -616,8 +630,9 @@ class AsyncOperations:
616
630
  entry_type: A formal entry pays the merchandise processing fee (MPF) on its value.
617
631
  An informal entry pays a fixed fee the estimate does not calculate: it gives no
618
632
  fees.
619
- facts: Answers that hold for the whole declaration (GET /v2/facts, scope entry or
620
- shipment).
633
+ facts: Answers that hold for every line of the declaration, by name (GET /v2/facts):
634
+ a line's own answer comes first. Given here, mpf_exempt holds for the lines
635
+ entered under an agreement, and hmf_exempt for the declaration.
621
636
  freight: International freight in US dollars: no duty on it, it adds to the landed
622
637
  cost.
623
638
  include_fees: Count the entry fees (MPF, HMF) of the declaration.
@@ -625,8 +640,10 @@ class AsyncOperations:
625
640
  landed cost.
626
641
  label: A name for the saved estimate; needs save.
627
642
  publication_id: Calculate with this publication of the rules instead of the one in
628
- service on that date: the data.publication_id of an earlier answer gives the
629
- same result again, as long as the engine has not changed.
643
+ service on that date: the data.publication_id of an earlier answer gives its
644
+ rates and rules again, as long as the engine has not changed. What withholds an
645
+ estimate today (an incident, an official notice not yet read, an exclusion from
646
+ importation) still applies: a saved estimate alone keeps its result.
630
647
  reference: Your reference for the declaration.
631
648
  save: Save the estimate: only a saved estimate keeps its detail, is reported, and is
632
649
  notified if a rate proves wrong. An answer without a figure is not saved. Send
@@ -685,7 +702,8 @@ class AsyncOperations:
685
702
  An informal entry pays a fixed fee the estimate does not calculate: it gives no
686
703
  fees.
687
704
  facts: Answers to the questions of the facts catalogue (GET /v2/facts), by name. A
688
- name outside the catalogue is said in warnings and never used.
705
+ name that is no question is refused, so that a typing error never gives a figure
706
+ on the ordinary case.
689
707
  freight: International freight in US dollars: no duty on it, it adds to the landed
690
708
  cost.
691
709
  from_: First day of the period. Unset: the first edition the service holds.
@@ -721,10 +739,10 @@ class AsyncOperations:
721
739
  ) -> FactList:
722
740
  """List the questions an estimate may ask.
723
741
 
724
- The facts catalogue: each question a measure may depend on, by the name to answer it
725
- with in facts, its type, its choices and its ordinary case. An answer names the ones it
726
- needs in missing, and those it rests on in facts. Needs the read permission; not
727
- counted.
742
+ The questions that can change an answer today: each by the name to answer it with in
743
+ facts, its type, its choices and its ordinary case. An answer names the ones it needs in
744
+ missing, and those it rests on in facts. The example shows two of them; the answer lists
745
+ them all. Needs the read permission; not counted.
728
746
  """
729
747
  return await self._request(
730
748
  "GET",
@@ -1,3 +1,3 @@
1
1
  """The package's version, the one in pyproject.toml."""
2
2
 
3
- __version__ = "0.2.0"
3
+ __version__ = "0.3.1"
@@ -38,8 +38,9 @@ class BatchItem(_BatchItemRequired, total=False):
38
38
  pays a fixed fee the estimate does not calculate: it gives no fees.
39
39
  """
40
40
  facts: Mapping[str, int | float | Decimal | str | bool]
41
- """Answers to the questions of the facts catalogue (GET /v2/facts), by name. A name outside
42
- the catalogue is said in warnings and never used.
41
+ """Answers to the questions of the facts catalogue (GET /v2/facts), by name. A name that is
42
+ no question is refused, so that a typing error never gives a figure on the ordinary
43
+ case.
43
44
  """
44
45
  freight: int | float | Decimal | str
45
46
  """International freight in US dollars: no duty on it, it adds to the landed cost."""
@@ -86,12 +87,14 @@ class _LineInputRequired(TypedDict):
86
87
  class LineInput(_LineInputRequired, total=False):
87
88
  """One line of a declaration."""
88
89
  customs_value: int | float | Decimal | str | None
89
- """Customs value in US dollars: the transaction value declared, not a retail price. Unset:
90
- the duty rate is given, and an amount only where the duty does not depend on the value.
90
+ """Customs value in US dollars: the transaction value declared, not a retail price. A
91
+ declaration's line asks for it, the fees resting on it: without it, the line gives no
92
+ rate and no amount.
91
93
  """
92
94
  facts: Mapping[str, int | float | Decimal | str | bool]
93
- """Answers to the questions of the facts catalogue (GET /v2/facts), by name. A name outside
94
- the catalogue is said in warnings and never used.
95
+ """Answers to the questions of the facts catalogue (GET /v2/facts), by name. A name that is
96
+ no question is refused, so that a typing error never gives a figure on the ordinary
97
+ case.
95
98
  """
96
99
  preference: str | None
97
100
  """A trade agreement's symbol from the HTS special column (S for USMCA, KR for KORUS…; GET
@@ -142,6 +145,24 @@ class AgreementList(Model):
142
145
  """Where the tariff that names them is published."""
143
146
 
144
147
 
148
+ class AskedBy(Model):
149
+ """An official text that asks a question: read it to answer precisely."""
150
+
151
+ _fields: ClassVar[frozenset[str]] = frozenset(['heading', 'title', 'url'])
152
+ _required: ClassVar[frozenset[str]] = frozenset(['heading', 'title', 'url'])
153
+
154
+ heading: str | None
155
+ """The Chapter 99 heading, or the tariff line, whose text asks it; null for a regulation."""
156
+
157
+ title: str
158
+ """What it is, in words."""
159
+
160
+ url: str
161
+ """Where to read it: the heading's page, with its text and the note it cites, or the
162
+ official document of a notice read ahead of the tariff.
163
+ """
164
+
165
+
145
166
  class AuditedDeclaration(Model):
146
167
  """A saved declaration's answer, with the detail behind it."""
147
168
 
@@ -253,8 +274,9 @@ class AuditedEstimate(Model):
253
274
  """All the duties, in US dollars. Null is unknown, never zero."""
254
275
 
255
276
  estimated_duty_rate: str | None
256
- """The duties as a fraction of the customs value: 0.365 is 36.5%. Without a value, the sum
257
- of the rates; null when a duty is not a percentage, or while a duty is withheld.
277
+ """The duties as a fraction of the customs value: 0.365 is 36.5%. The sum of the rates when
278
+ each duty is a percentage, with or without a value; else the duties over the value, to 4
279
+ places, null without a value. Null while a duty is withheld.
258
280
  """
259
281
 
260
282
  estimated_fees: str | None
@@ -349,8 +371,9 @@ class AuditedLine(Model):
349
371
  """All the duties, in US dollars. Null is unknown, never zero."""
350
372
 
351
373
  estimated_duty_rate: str | None
352
- """The duties as a fraction of the customs value: 0.365 is 36.5%. Without a value, the sum
353
- of the rates; null when a duty is not a percentage, or while a duty is withheld.
374
+ """The duties as a fraction of the customs value: 0.365 is 36.5%. The sum of the rates when
375
+ each duty is a percentage, else the duties over the value, to 4 places. Null while a
376
+ duty is withheld.
354
377
  """
355
378
 
356
379
  facts: dict[str, Any] | None
@@ -660,8 +683,9 @@ class Estimate(Model):
660
683
  """All the duties, in US dollars. Null is unknown, never zero."""
661
684
 
662
685
  estimated_duty_rate: str | None
663
- """The duties as a fraction of the customs value: 0.365 is 36.5%. Without a value, the sum
664
- of the rates; null when a duty is not a percentage, or while a duty is withheld.
686
+ """The duties as a fraction of the customs value: 0.365 is 36.5%. The sum of the rates when
687
+ each duty is a percentage, with or without a value; else the duties over the value, to 4
688
+ places, null without a value. Null while a duty is withheld.
665
689
  """
666
690
 
667
691
  estimated_fees: str | None
@@ -746,16 +770,25 @@ class FactChoice(Model):
746
770
  class FactDefinition(Model):
747
771
  """A question an estimate may ask about the goods or the declaration."""
748
772
 
749
- _fields: ClassVar[frozenset[str]] = frozenset(['choices', 'default', 'help', 'name', 'question', 'scope', 'type', 'unit'])
773
+ _fields: ClassVar[frozenset[str]] = frozenset(['asked_by', 'choices', 'default', 'help', 'name', 'question', 'scope', 'type', 'unit'])
750
774
  _required: ClassVar[frozenset[str]] = frozenset(['help', 'name', 'question', 'scope', 'type'])
751
- _nested: ClassVar[dict[str, Any]] = {'choices': ['FactChoice']}
752
- _defaults: ClassVar[dict[str, Any]] = {'choices': [], 'unit': ''}
775
+ _nested: ClassVar[dict[str, Any]] = {'asked_by': ['AskedBy'], 'choices': ['FactChoice']}
776
+ _defaults: ClassVar[dict[str, Any]] = {'asked_by': [], 'choices': [], 'unit': ''}
777
+
778
+ asked_by: list[AskedBy]
779
+ """The official texts that ask it today: the headings whose rules in service read it, or
780
+ the regulation of a fee. Empty for what depends on each product's own line (its rate,
781
+ its entry); an estimate names, in missing, those that ask it for its goods.
782
+ """
753
783
 
754
784
  choices: list[FactChoice]
755
785
  """For a choice: the values to choose from."""
756
786
 
757
787
  default: Any
758
- """The ordinary case, supposed when unanswered."""
788
+ """The ordinary case, supposed when unanswered. For an amount, "customs_value": the whole
789
+ customs value of the line; for a country, "origin": the origin of the line. Send a
790
+ value, never these names.
791
+ """
759
792
 
760
793
  help: str
761
794
  """What it means, and how to answer it."""
@@ -773,7 +806,7 @@ class FactDefinition(Model):
773
806
 
774
807
  type: str
775
808
  """How it is answered: boolean (true or false), choice (one of choices), money (US
776
- dollars), number, country (ISO code) or heading (a Chapter 99 heading).
809
+ dollars), number or country (ISO code).
777
810
  """
778
811
 
779
812
  unit: str
@@ -781,14 +814,14 @@ class FactDefinition(Model):
781
814
 
782
815
 
783
816
  class FactList(Model):
784
- """The facts catalogue: every question an estimate may ask."""
817
+ """The questions an estimate may ask."""
785
818
 
786
819
  _fields: ClassVar[frozenset[str]] = frozenset(['facts'])
787
820
  _required: ClassVar[frozenset[str]] = frozenset(['facts'])
788
821
  _nested: ClassVar[dict[str, Any]] = {'facts': ['FactDefinition']}
789
822
 
790
823
  facts: list[FactDefinition]
791
- """Every question of the catalogue."""
824
+ """The questions that can change an answer today."""
792
825
 
793
826
 
794
827
  class HistoryPoint(Model):
@@ -822,8 +855,9 @@ class HistoryPoint(Model):
822
855
  """All the duties, in US dollars. Null is unknown, never zero."""
823
856
 
824
857
  estimated_duty_rate: str | None
825
- """The duties as a fraction of the customs value: 0.365 is 36.5%. Without a value, the sum
826
- of the rates; null when a duty is not a percentage, or while a duty is withheld.
858
+ """The duties as a fraction of the customs value: 0.365 is 36.5%. The sum of the rates when
859
+ each duty is a percentage, with or without a value; else the duties over the value, to 4
860
+ places, null without a value. Null while a duty is withheld.
827
861
  """
828
862
 
829
863
  estimated_fees: str | None
@@ -1076,8 +1110,9 @@ class Line(Model):
1076
1110
  """All the duties, in US dollars. Null is unknown, never zero."""
1077
1111
 
1078
1112
  estimated_duty_rate: str | None
1079
- """The duties as a fraction of the customs value: 0.365 is 36.5%. Without a value, the sum
1080
- of the rates; null when a duty is not a percentage, or while a duty is withheld.
1113
+ """The duties as a fraction of the customs value: 0.365 is 36.5%. The sum of the rates when
1114
+ each duty is a percentage, else the duties over the value, to 4 places. Null while a
1115
+ duty is withheld.
1081
1116
  """
1082
1117
 
1083
1118
  facts: dict[str, Any] | None
@@ -1122,8 +1157,12 @@ class Line(Model):
1122
1157
  class MissingField(Model):
1123
1158
  """What the service needs to give a figure."""
1124
1159
 
1125
- _fields: ClassVar[frozenset[str]] = frozenset(['choices', 'field', 'question', 'type', 'unit'])
1160
+ _fields: ClassVar[frozenset[str]] = frozenset(['asked_by', 'choices', 'field', 'question', 'type', 'unit'])
1126
1161
  _required: ClassVar[frozenset[str]] = frozenset(['field', 'question', 'type'])
1162
+ _nested: ClassVar[dict[str, Any]] = {'asked_by': ['AskedBy']}
1163
+
1164
+ asked_by: list[AskedBy] | None
1165
+ """The official texts that ask it for these goods, to answer it precisely."""
1127
1166
 
1128
1167
  choices: list[Any] | None
1129
1168
  """The values a choice takes."""
@@ -1135,9 +1174,7 @@ class MissingField(Model):
1135
1174
  """What it asks, in words."""
1136
1175
 
1137
1176
  type: str
1138
- """The type of its value: number, money, boolean, choice, text, heading, country or
1139
- datetime.
1140
- """
1177
+ """The type of its value: number, money, boolean, choice, text, country or datetime."""
1141
1178
 
1142
1179
  unit: str | None
1143
1180
  """The unit of a quantity."""
@@ -456,7 +456,7 @@ wheels = [
456
456
 
457
457
  [[package]]
458
458
  name = "tarifftrust"
459
- version = "0.2.0"
459
+ version = "0.3.1"
460
460
  source = { editable = "." }
461
461
  dependencies = [
462
462
  { name = "httpx" },
File without changes
File without changes
File without changes