<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.usnan.org/index.php?action=history&amp;feed=atom&amp;title=USNAN_Python_SDK%2FGetting_Started</id>
	<title>USNAN Python SDK/Getting Started - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.usnan.org/index.php?action=history&amp;feed=atom&amp;title=USNAN_Python_SDK%2FGetting_Started"/>
	<link rel="alternate" type="text/html" href="https://wiki.usnan.org/index.php?title=USNAN_Python_SDK/Getting_Started&amp;action=history"/>
	<updated>2026-05-06T13:32:33Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://wiki.usnan.org/index.php?title=USNAN_Python_SDK/Getting_Started&amp;diff=1338&amp;oldid=prev</id>
		<title>Mmaciejewski at 17:41, 7 October 2025</title>
		<link rel="alternate" type="text/html" href="https://wiki.usnan.org/index.php?title=USNAN_Python_SDK/Getting_Started&amp;diff=1338&amp;oldid=prev"/>
		<updated>2025-10-07T17:41:47Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:41, 7 October 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{SDK_navigation}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= &amp;#039;&amp;#039;&amp;#039;Getting Started with the USNAN Python SDK&amp;#039;&amp;#039;&amp;#039; =&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= &amp;#039;&amp;#039;&amp;#039;Getting Started with the USNAN Python SDK&amp;#039;&amp;#039;&amp;#039; =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key nanwiki:diff:1.41:old-1329:rev-1338:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Mmaciejewski</name></author>
	</entry>
	<entry>
		<id>https://wiki.usnan.org/index.php?title=USNAN_Python_SDK/Getting_Started&amp;diff=1329&amp;oldid=prev</id>
		<title>Mmaciejewski: Created page with &quot;= &#039;&#039;&#039;Getting Started with the USNAN Python SDK&#039;&#039;&#039; =  == &#039;&#039;&#039;Creating a Client&#039;&#039;&#039; == The core entry point is the &#039;&#039;&#039;USNANClient&#039;&#039;&#039; class.  &lt;syntaxhighlight lang=&quot;python&quot;&gt; import usnan client = usnan.USNANClient() &lt;/syntaxhighlight&gt;  By default, it connects to the public API at: &lt;syntaxhighlight&gt; https://dev.api.nmrhub.org &lt;/syntaxhighlight&gt;  Optional parameters: * &#039;&#039;&#039;base_url&#039;&#039;&#039; – override the API endpoint * &#039;&#039;&#039;timeout&#039;&#039;&#039; – request timeout in seconds * &#039;&#039;&#039;num_retries&#039;&#039;...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.usnan.org/index.php?title=USNAN_Python_SDK/Getting_Started&amp;diff=1329&amp;oldid=prev"/>
		<updated>2025-10-07T17:28:03Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;= &amp;#039;&amp;#039;&amp;#039;Getting Started with the USNAN Python SDK&amp;#039;&amp;#039;&amp;#039; =  == &amp;#039;&amp;#039;&amp;#039;Creating a Client&amp;#039;&amp;#039;&amp;#039; == The core entry point is the &amp;#039;&amp;#039;&amp;#039;USNANClient&amp;#039;&amp;#039;&amp;#039; class.  &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt; import usnan client = usnan.USNANClient() &amp;lt;/syntaxhighlight&amp;gt;  By default, it connects to the public API at: &amp;lt;syntaxhighlight&amp;gt; https://dev.api.nmrhub.org &amp;lt;/syntaxhighlight&amp;gt;  Optional parameters: * &amp;#039;&amp;#039;&amp;#039;base_url&amp;#039;&amp;#039;&amp;#039; – override the API endpoint * &amp;#039;&amp;#039;&amp;#039;timeout&amp;#039;&amp;#039;&amp;#039; – request timeout in seconds * &amp;#039;&amp;#039;&amp;#039;num_retries&amp;#039;&amp;#039;...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= &amp;#039;&amp;#039;&amp;#039;Getting Started with the USNAN Python SDK&amp;#039;&amp;#039;&amp;#039; =&lt;br /&gt;
&lt;br /&gt;
== &amp;#039;&amp;#039;&amp;#039;Creating a Client&amp;#039;&amp;#039;&amp;#039; ==&lt;br /&gt;
The core entry point is the &amp;#039;&amp;#039;&amp;#039;USNANClient&amp;#039;&amp;#039;&amp;#039; class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import usnan&lt;br /&gt;
client = usnan.USNANClient()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, it connects to the public API at:&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
https://dev.api.nmrhub.org&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Optional parameters:&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;base_url&amp;#039;&amp;#039;&amp;#039; – override the API endpoint&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;timeout&amp;#039;&amp;#039;&amp;#039; – request timeout in seconds&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;num_retries&amp;#039;&amp;#039;&amp;#039; – automatic retry attempts&lt;br /&gt;
&lt;br /&gt;
== &amp;#039;&amp;#039;&amp;#039;Listing Facilities&amp;#039;&amp;#039;&amp;#039; ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
for fac in client.facilities.list():&lt;br /&gt;
    print(fac.identifier, fac.long_name)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each facility exposes linked spectrometers and probes.&lt;br /&gt;
&lt;br /&gt;
== &amp;#039;&amp;#039;&amp;#039;Searching for Datasets&amp;#039;&amp;#039;&amp;#039; ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
cfg = (&lt;br /&gt;
    usnan.models.SearchConfig(records=50)&lt;br /&gt;
      .add_filter(&amp;quot;is_knowledgebase&amp;quot;, value=True, match_mode=&amp;quot;equals&amp;quot;)&lt;br /&gt;
      .add_filter(&amp;quot;num_dimension&amp;quot;, value=2, match_mode=&amp;quot;equals&amp;quot;)&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
for ds in client.datasets.search(cfg):&lt;br /&gt;
    print(ds.id, ds.title, ds.num_dimension)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;#039;&amp;#039;&amp;#039;Downloading Datasets&amp;#039;&amp;#039;&amp;#039; ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
client.datasets.download([363067], location=&amp;quot;data/&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files are stored in a directory structure mirroring dataset identifiers.&lt;br /&gt;
&lt;br /&gt;
== &amp;#039;&amp;#039;&amp;#039;Caching and Error Handling&amp;#039;&amp;#039;&amp;#039; ==&lt;br /&gt;
The SDK caches facilities, spectrometers, and probes for efficiency.  &lt;br /&gt;
To refresh the cache:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
client.clear_cache()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Common exceptions:&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;TypeError&amp;#039;&amp;#039;&amp;#039; – invalid argument types&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;KeyError&amp;#039;&amp;#039;&amp;#039; – missing entity ID&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;ValueError&amp;#039;&amp;#039;&amp;#039; – inconsistent filter operators&lt;/div&gt;</summary>
		<author><name>Mmaciejewski</name></author>
	</entry>
</feed>