<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Devnors Data MCP on RockB</title><link>https://baeseokjae.github.io/tags/devnors-data-mcp/</link><description>Recent content in Devnors Data MCP on RockB</description><image><title>RockB</title><url>https://baeseokjae.github.io/images/og-default.png</url><link>https://baeseokjae.github.io/images/og-default.png</link></image><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 28 Jul 2026 04:02:29 +0000</lastBuildDate><atom:link href="https://baeseokjae.github.io/tags/devnors-data-mcp/index.xml" rel="self" type="application/rss+xml"/><item><title>Devnors Data Python SDK Guide 2026: Legal and Business Data API for AI Agents</title><link>https://baeseokjae.github.io/posts/devnors-data-python-sdk-2026/</link><pubDate>Tue, 28 Jul 2026 04:02:29 +0000</pubDate><guid>https://baeseokjae.github.io/posts/devnors-data-python-sdk-2026/</guid><description>Learn how to use the Devnors Data Python SDK to query legal cases, enterprise records, academic research, and content data via a single unified API endpoint for AI agents.</description><content:encoded><![CDATA[<p>The Devnors Data Python SDK (<code>devnors-data</code> on PyPI) is a lightweight, MIT-licensed client library that gives AI agents and Python developers a single unified gateway to five data domains — legal cases, enterprise records, content indexes, cloud services, and academic research — through one API key and one <code>POST /v1/data/query</code> endpoint. With 68,787 legal cases indexed, automatic retry with exponential backoff, async support, and pay-per-use pricing starting at ¥0.01 per call, it is the most practical data API for building China-focused AI agents in 2026.</p>
<h2 id="what-is-devnors-data">What Is Devnors Data?</h2>
<p>Devnors Data is a unified data API platform purpose-built for AI agents and developers who need structured, traceable data from Chinese sources. Unlike general-purpose data APIs that require separate integrations for each data type, Devnors Data consolidates five distinct data domains behind a single authentication scheme and a single query endpoint.</p>
<p>The platform launched with a legal data domain and rapidly expanded between July 22 and July 27, 2026, adding enterprise data, content indexes, cloud services, and academic research in a single week. This aggressive expansion reflects a clear product vision: become the default data layer for AI agents operating in the Chinese market.</p>
<h3 id="data-domains-covered">Data Domains Covered</h3>
<table>
  <thead>
      <tr>
          <th>Domain</th>
          <th>Launch Date</th>
          <th>Key Endpoints</th>
          <th>Example Use Case</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Legal</td>
          <td>Initial</td>
          <td>Legal cases, law articles, law catalog</td>
          <td>Retrieve judgment documents for legal research</td>
      </tr>
      <tr>
          <td>Enterprise</td>
          <td>July 22-23, 2026</td>
          <td>Company detail, annual report, tax invoice, shixin/zhixing check</td>
          <td>Verify company registration status</td>
      </tr>
      <tr>
          <td>Content</td>
          <td>July 22, 2026</td>
          <td>Keyword index, WeChat index, hot rank</td>
          <td>Track trending topics on Chinese social media</td>
      </tr>
      <tr>
          <td>Cloud</td>
          <td>July 22, 2026</td>
          <td>Express tracking</td>
          <td>Track logistics shipments</td>
      </tr>
      <tr>
          <td>Academic Research</td>
          <td>July 27, 2026</td>
          <td>Paper search, patent search, journal search, scholar search</td>
          <td>Find Chinese academic papers by keyword</td>
      </tr>
  </tbody>
</table>
<p>Each domain returns structured JSON responses with official-source traceability, making the data suitable for automated decision-making in AI agent workflows.</p>
<h2 id="getting-started-with-the-python-sdk">Getting Started with the Python SDK</h2>
<p>The Devnors Data Python SDK is designed as a thin wrapper over the unified API gateway. It handles authentication, request serialization, response parsing, retry logic, and pagination so you can focus on building your application.</p>
<h3 id="installation">Installation</h3>
<p>Install the package from PyPI with a single command:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>pip install devnors-data
</span></span></code></pre></div><p>The package requires Python 3.9 or later and depends on <code>httpx&gt;=0.24</code> for HTTP transport. Version 0.1.1 is the current stable release as of July 2026.</p>
<h3 id="api-key-setup">API Key Setup</h3>
<ol>
<li>Sign up at <a href="https://data.devnors.com">data.devnors.com</a> to receive your free trial quota.</li>
<li>Navigate to the developer console to generate an API key.</li>
<li>Set the key as an environment variable:</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>export DEVNORS_DATA_API_KEY<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;your-api-key-here&#34;</span>
</span></span></code></pre></div><p>The SDK reads <code>DEVNORS_DATA_API_KEY</code> from the environment by default, which is the recommended approach for production deployments. You can also pass the key directly to the client constructor.</p>
<h3 id="quick-start-example">Quick Start Example</h3>
<p>Here is the minimal code to query legal cases:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#f92672">from</span> devnors_data <span style="color:#f92672">import</span> DevnorsData
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>client <span style="color:#f92672">=</span> DevnorsData()  <span style="color:#75715e"># reads DEVNORS_DATA_API_KEY from env</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Query legal cases about contract disputes</span>
</span></span><span style="display:flex;"><span>response <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>legal_cases(
</span></span><span style="display:flex;"><span>    query<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;contract dispute&#34;</span>,
</span></span><span style="display:flex;"><span>    page<span style="color:#f92672">=</span><span style="color:#ae81ff">1</span>,
</span></span><span style="display:flex;"><span>    page_size<span style="color:#f92672">=</span><span style="color:#ae81ff">10</span>
</span></span><span style="display:flex;"><span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">for</span> <span style="color:#66d9ef">case</span> <span style="color:#f92672">in</span> response<span style="color:#f92672">.</span>data:
</span></span><span style="display:flex;"><span>    print(<span style="color:#e6db74">f</span><span style="color:#e6db74">&#34;</span><span style="color:#e6db74">{</span>case<span style="color:#f92672">.</span>case_id<span style="color:#e6db74">}</span><span style="color:#e6db74">: </span><span style="color:#e6db74">{</span>case<span style="color:#f92672">.</span>title<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span>)
</span></span></code></pre></div><p>The client automatically handles authentication headers, request formatting, and response deserialization. The same pattern works for every data domain.</p>
<h2 id="core-api-usage">Core API Usage</h2>
<h3 id="the-unified-v1dataquery-endpoint">The Unified /v1/data/query Endpoint</h3>
<p>Every SDK method ultimately sends a <code>POST</code> request to <code>https://data.devnors.com/v1/data/query</code>. The request body specifies the data domain, query parameters, and pagination options. The SDK abstracts this into domain-specific methods, but you can also call the raw endpoint directly if you need custom behavior.</p>
<p>The unified design means you only need one API key, one base URL, and one authentication mechanism for all five data domains. This is especially valuable for AI agents that need to switch between data types in a single workflow without managing multiple API integrations.</p>
<h3 id="domain-specific-methods">Domain-Specific Methods</h3>
<p>The SDK provides dedicated methods for each data domain:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#75715e"># Legal domain</span>
</span></span><span style="display:flex;"><span>cases <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>legal_cases(query<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;知识产权&#34;</span>, page<span style="color:#f92672">=</span><span style="color:#ae81ff">1</span>, page_size<span style="color:#f92672">=</span><span style="color:#ae81ff">20</span>)
</span></span><span style="display:flex;"><span>laws <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>legal_laws(query<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;公司法&#34;</span>, page<span style="color:#f92672">=</span><span style="color:#ae81ff">1</span>, page_size<span style="color:#f92672">=</span><span style="color:#ae81ff">10</span>)
</span></span><span style="display:flex;"><span>catalog <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>legal_law_catalog()
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Enterprise domain</span>
</span></span><span style="display:flex;"><span>company <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>enterprise_company_detail(tax_id<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;91440101MA5...&#34;</span>)
</span></span><span style="display:flex;"><span>annual <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>enterprise_annual_report(tax_id<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;91440101MA5...&#34;</span>)
</span></span><span style="display:flex;"><span>invoice <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>enterprise_tax_invoice(invoice_code<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;...&#34;</span>)
</span></span><span style="display:flex;"><span>shixin <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>enterprise_shixin_check(company_name<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;...&#34;</span>)
</span></span><span style="display:flex;"><span>zhixing <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>enterprise_zhixing_check(company_name<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;...&#34;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Content domain</span>
</span></span><span style="display:flex;"><span>keyword_index <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>content_keyword_index(keyword<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;AI&#34;</span>, date<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;2026-07-28&#34;</span>)
</span></span><span style="display:flex;"><span>wechat_index <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>content_wechat_index(keyword<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;大模型&#34;</span>, date<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;2026-07-28&#34;</span>)
</span></span><span style="display:flex;"><span>hot_rank <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>content_hot_rank(platform<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;douyin&#34;</span>, date<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;2026-07-28&#34;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Cloud services</span>
</span></span><span style="display:flex;"><span>tracking <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>cloud_express_tracking(express_no<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;SF1234567890&#34;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Academic research</span>
</span></span><span style="display:flex;"><span>papers <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>research_paper_search(query<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;machine learning&#34;</span>, page<span style="color:#f92672">=</span><span style="color:#ae81ff">1</span>, page_size<span style="color:#f92672">=</span><span style="color:#ae81ff">10</span>)
</span></span><span style="display:flex;"><span>patents <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>research_patent_search(query<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;人工智能&#34;</span>, page<span style="color:#f92672">=</span><span style="color:#ae81ff">1</span>, page_size<span style="color:#f92672">=</span><span style="color:#ae81ff">10</span>)
</span></span><span style="display:flex;"><span>journals <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>research_journal_search(query<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;自然语言处理&#34;</span>, page<span style="color:#f92672">=</span><span style="color:#ae81ff">1</span>, page_size<span style="color:#f92672">=</span><span style="color:#ae81ff">10</span>)
</span></span><span style="display:flex;"><span>scholars <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>research_scholar_search(name<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;李飞飞&#34;</span>, page<span style="color:#f92672">=</span><span style="color:#ae81ff">1</span>, page_size<span style="color:#f92672">=</span><span style="color:#ae81ff">10</span>)
</span></span></code></pre></div><p>Each method returns a structured response object with typed fields, making it easy to integrate with Python type checkers and IDE autocompletion.</p>
<h3 id="async-client">Async Client</h3>
<p>For AI agents that handle multiple concurrent queries, the SDK provides an async client:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#f92672">from</span> devnors_data <span style="color:#f92672">import</span> AsyncDevnorsData
</span></span><span style="display:flex;"><span><span style="color:#f92672">import</span> asyncio
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">async</span> <span style="color:#66d9ef">def</span> <span style="color:#a6e22e">query_multiple_domains</span>():
</span></span><span style="display:flex;"><span>    client <span style="color:#f92672">=</span> AsyncDevnorsData()
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#75715e"># Run queries concurrently</span>
</span></span><span style="display:flex;"><span>    cases, company_data, papers <span style="color:#f92672">=</span> <span style="color:#66d9ef">await</span> asyncio<span style="color:#f92672">.</span>gather(
</span></span><span style="display:flex;"><span>        client<span style="color:#f92672">.</span>legal_cases(query<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;patent infringement&#34;</span>, page<span style="color:#f92672">=</span><span style="color:#ae81ff">1</span>, page_size<span style="color:#f92672">=</span><span style="color:#ae81ff">5</span>),
</span></span><span style="display:flex;"><span>        client<span style="color:#f92672">.</span>enterprise_company_detail(tax_id<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;91440101MA5...&#34;</span>),
</span></span><span style="display:flex;"><span>        client<span style="color:#f92672">.</span>research_paper_search(query<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;AI regulation&#34;</span>, page<span style="color:#f92672">=</span><span style="color:#ae81ff">1</span>, page_size<span style="color:#f92672">=</span><span style="color:#ae81ff">5</span>)
</span></span><span style="display:flex;"><span>    )
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    print(<span style="color:#e6db74">f</span><span style="color:#e6db74">&#34;Found </span><span style="color:#e6db74">{</span>len(cases<span style="color:#f92672">.</span>data)<span style="color:#e6db74">}</span><span style="color:#e6db74"> cases&#34;</span>)
</span></span><span style="display:flex;"><span>    print(<span style="color:#e6db74">f</span><span style="color:#e6db74">&#34;Company: </span><span style="color:#e6db74">{</span>company_data<span style="color:#f92672">.</span>name<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span>)
</span></span><span style="display:flex;"><span>    print(<span style="color:#e6db74">f</span><span style="color:#e6db74">&#34;Found </span><span style="color:#e6db74">{</span>len(papers<span style="color:#f92672">.</span>data)<span style="color:#e6db74">}</span><span style="color:#e6db74"> papers&#34;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>asyncio<span style="color:#f92672">.</span>run(query_multiple_domains())
</span></span></code></pre></div><p>The async client uses <code>httpx.AsyncClient</code> under the hood and supports the same automatic retry and error handling as the synchronous client.</p>
<h3 id="pagination-with-paginate">Pagination with paginate()</h3>
<p>For queries that return large result sets, the SDK provides a <code>paginate()</code> helper that automatically iterates through pages:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#75715e"># Iterate through all pages of legal cases</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">for</span> page <span style="color:#f92672">in</span> client<span style="color:#f92672">.</span>paginate(<span style="color:#e6db74">&#34;legal_cases&#34;</span>, query<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;商标侵权&#34;</span>, page_size<span style="color:#f92672">=</span><span style="color:#ae81ff">50</span>):
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">for</span> <span style="color:#66d9ef">case</span> <span style="color:#f92672">in</span> page<span style="color:#f92672">.</span>data:
</span></span><span style="display:flex;"><span>        print(<span style="color:#e6db74">f</span><span style="color:#e6db74">&#34;</span><span style="color:#e6db74">{</span>case<span style="color:#f92672">.</span>case_id<span style="color:#e6db74">}</span><span style="color:#e6db74">: </span><span style="color:#e6db74">{</span>case<span style="color:#f92672">.</span>title<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span>)
</span></span><span style="display:flex;"><span>    print(<span style="color:#e6db74">f</span><span style="color:#e6db74">&#34;--- Page </span><span style="color:#e6db74">{</span>page<span style="color:#f92672">.</span>page<span style="color:#e6db74">}</span><span style="color:#e6db74"> of </span><span style="color:#e6db74">{</span>page<span style="color:#f92672">.</span>total_pages<span style="color:#e6db74">}</span><span style="color:#e6db74"> ---&#34;</span>)
</span></span></code></pre></div><p>The <code>paginate()</code> method handles page tracking, respects rate limits between requests, and stops when all pages are consumed. This is essential for AI agents that need to process complete datasets rather than just the first page of results.</p>
<h2 id="data-domains-deep-dive">Data Domains Deep Dive</h2>
<h3 id="legal-data">Legal Data</h3>
<p>The legal domain is the original and most mature data domain on Devnors Data. As of July 2026, the platform has indexed 68,787 legal judgment documents with continuous updates every 30 days. The legal API supports three endpoints:</p>
<ul>
<li><strong>Legal Cases</strong>: Search judgment documents by keyword, court, judge, or legal basis. Returns case ID, title, court name, judgment date, case type, and full judgment text.</li>
<li><strong>Law Articles</strong>: Query specific law articles by law name and article number. Returns the full text of the article with revision history.</li>
<li><strong>Law Catalog</strong>: Retrieve the complete catalog of Chinese laws and regulations organized by legal domain.</li>
</ul>
<p>This data is particularly valuable for legal tech AI agents, compliance automation tools, and legal research platforms targeting the Chinese market.</p>
<h3 id="enterprise-data">Enterprise Data</h3>
<p>Launched July 22-23, 2026, the enterprise data domain provides access to Chinese company registration and compliance information:</p>
<ul>
<li><strong>Company Detail</strong>: Look up a company by its unified social credit code (tax ID). Returns company name, registration status, legal representative, registered capital, business scope, and registration date.</li>
<li><strong>Annual Report</strong>: Retrieve the latest annual report filing for a company, including financial highlights and employee count.</li>
<li><strong>Tax Invoice Verification</strong>: Verify the authenticity of Chinese tax invoices by invoice code and number.</li>
<li><strong>Shixin Check</strong>: Check if a company or individual is on the失信被执行人 (dishonesty blacklist) maintained by Chinese courts.</li>
<li><strong>Zhixing Check</strong>: Query enforcement cases against a company, including case status and enforcement amount.</li>
</ul>
<p>Enterprise data is priced at ¥0.2 per call (10,000 tokens) for company detail, with the annual report endpoint at ¥1 per call (50,000 tokens) being the most expensive endpoint on the platform.</p>
<h3 id="content-data">Content Data</h3>
<p>The content domain, launched July 22, 2026, provides access to Chinese social media and content platform metrics:</p>
<ul>
<li><strong>Keyword Index</strong>: Track search volume trends for keywords across Chinese search engines.</li>
<li><strong>WeChat Index</strong>: Monitor keyword popularity on WeChat&rsquo;s official accounts and Moments.</li>
<li><strong>Hot Rank</strong>: Retrieve trending topic rankings from platforms like Douyin (TikTok China), Weibo, and Baidu.</li>
</ul>
<p>This domain is essential for AI agents performing social media monitoring, trend analysis, and content strategy in the Chinese market.</p>
<h3 id="cloud-services">Cloud Services</h3>
<p>The cloud domain currently offers one endpoint:</p>
<ul>
<li><strong>Express Tracking</strong>: Track logistics shipments by tracking number. Supports major Chinese carriers including SF Express, YTO, ZTO, Yunda, and China Post.</li>
</ul>
<p>This is a practical addition for AI agents handling e-commerce logistics, supply chain monitoring, or customer service automation.</p>
<h3 id="academic-research">Academic Research</h3>
<p>The newest domain, launched July 27, 2026, provides access to Chinese academic research databases:</p>
<ul>
<li><strong>Paper Search</strong>: Search Chinese academic papers by keyword, author, or institution. Returns title, authors, abstract, publication date, and citation count.</li>
<li><strong>Patent Search</strong>: Query Chinese patents by keyword, patent number, or applicant.</li>
<li><strong>Journal Search</strong>: Search for Chinese academic journals by name or ISSN.</li>
<li><strong>Scholar Search</strong>: Find Chinese researchers by name or institution, with their publication history.</li>
</ul>
<p>At ¥0.01 per call (500 tokens), academic research is the most affordable domain, making it ideal for high-volume research automation.</p>
<h2 id="error-handling-and-retry">Error Handling and Retry</h2>
<h3 id="automatic-retry-with-exponential-backoff">Automatic Retry with Exponential Backoff</h3>
<p>The SDK automatically retries failed requests on HTTP 429 (rate limited) and 5xx (server error) status codes. The retry strategy uses exponential backoff with jitter to avoid thundering herd problems:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#75715e"># Default retry behavior — automatic</span>
</span></span><span style="display:flex;"><span>response <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>legal_cases(query<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;contract dispute&#34;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># The SDK retries on 429 and 5xx with:</span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># - Initial delay: 1 second</span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># - Backoff factor: 2x</span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># - Maximum retries: 3</span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># - Jitter: ±0.5 seconds</span>
</span></span></code></pre></div><p>You can configure retry behavior when creating the client:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#f92672">from</span> devnors_data <span style="color:#f92672">import</span> DevnorsData
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>client <span style="color:#f92672">=</span> DevnorsData(
</span></span><span style="display:flex;"><span>    max_retries<span style="color:#f92672">=</span><span style="color:#ae81ff">5</span>,
</span></span><span style="display:flex;"><span>    retry_delay<span style="color:#f92672">=</span><span style="color:#ae81ff">2.0</span>,
</span></span><span style="display:flex;"><span>    retry_backoff<span style="color:#f92672">=</span><span style="color:#ae81ff">3.0</span>
</span></span><span style="display:flex;"><span>)
</span></span></code></pre></div><h3 id="structured-error-types">Structured Error Types</h3>
<p>The SDK raises typed exceptions for different error conditions:</p>
<table>
  <thead>
      <tr>
          <th>Error Type</th>
          <th>HTTP Status</th>
          <th>Description</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>DevnorsDataError</code></td>
          <td>Various</td>
          <td>Base exception for all SDK errors</td>
      </tr>
      <tr>
          <td><code>AuthenticationError</code></td>
          <td>401</td>
          <td>Invalid or missing API key</td>
      </tr>
      <tr>
          <td><code>InsufficientBalanceError</code></td>
          <td>402</td>
          <td>Account balance too low for the request</td>
      </tr>
      <tr>
          <td><code>RateLimitError</code></td>
          <td>429</td>
          <td>Too many requests, retry after backoff</td>
      </tr>
      <tr>
          <td><code>ServerError</code></td>
          <td>5xx</td>
          <td>Devnors Data server error, will be retried</td>
      </tr>
  </tbody>
</table>
<p>This structured error handling allows AI agents to implement domain-specific fallback logic:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#f92672">from</span> devnors_data <span style="color:#f92672">import</span> DevnorsData, InsufficientBalanceError
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>client <span style="color:#f92672">=</span> DevnorsData()
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">try</span>:
</span></span><span style="display:flex;"><span>    response <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>enterprise_company_detail(tax_id<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;91440101MA5...&#34;</span>)
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">except</span> InsufficientBalanceError:
</span></span><span style="display:flex;"><span>    print(<span style="color:#e6db74">&#34;Insufficient balance — notify admin to top up&#34;</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#75715e"># Switch to cached data or fallback source</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">except</span> AuthenticationError:
</span></span><span style="display:flex;"><span>    print(<span style="color:#e6db74">&#34;API key invalid — check DEVNORS_DATA_API_KEY&#34;</span>)
</span></span></code></pre></div><h3 id="billing-errors">Billing Errors</h3>
<p>The 402 <code>InsufficientBalanceError</code> is unique to Devnors Data&rsquo;s pay-per-use model. When your account balance drops below the cost of a request, the API returns this error instead of silently failing or returning partial data. The SDK surfaces this as a clear exception so your AI agent can take appropriate action — notify an administrator, switch to a cached data source, or queue the request for later retry.</p>
<h3 id="rate-limiting">Rate Limiting</h3>
<p>The 429 <code>RateLimitError</code> includes a <code>retry_after</code> field indicating how long to wait before retrying. The SDK&rsquo;s automatic retry mechanism respects this field, but you can also handle it manually for fine-grained control:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#f92672">from</span> devnors_data <span style="color:#f92672">import</span> DevnorsData, RateLimitError
</span></span><span style="display:flex;"><span><span style="color:#f92672">import</span> time
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>client <span style="color:#f92672">=</span> DevnorsData(max_retries<span style="color:#f92672">=</span><span style="color:#ae81ff">0</span>)  <span style="color:#75715e"># Disable auto-retry</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">try</span>:
</span></span><span style="display:flex;"><span>    response <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>legal_cases(query<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;patent&#34;</span>)
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">except</span> RateLimitError <span style="color:#66d9ef">as</span> e:
</span></span><span style="display:flex;"><span>    wait_time <span style="color:#f92672">=</span> e<span style="color:#f92672">.</span>retry_after  <span style="color:#75715e"># seconds</span>
</span></span><span style="display:flex;"><span>    print(<span style="color:#e6db74">f</span><span style="color:#e6db74">&#34;Rate limited, waiting </span><span style="color:#e6db74">{</span>wait_time<span style="color:#e6db74">}</span><span style="color:#e6db74">s...&#34;</span>)
</span></span><span style="display:flex;"><span>    time<span style="color:#f92672">.</span>sleep(wait_time)
</span></span><span style="display:flex;"><span>    response <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>legal_cases(query<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;patent&#34;</span>)
</span></span></code></pre></div><h2 id="pricing-and-billing">Pricing and Billing</h2>
<p>Devnors Data uses a transparent pay-per-use pricing model with no monthly fees, no prepayment requirements, and automatic refunds for failed calls.</p>
<h3 id="token-based-pricing">Token-Based Pricing</h3>
<p>Each API call consumes a fixed number of tokens based on the endpoint. Tokens are purchased in bundles, with 1 CNY purchasing 50,000 tokens. The actual cost per call varies by data domain:</p>
<table>
  <thead>
      <tr>
          <th>Endpoint</th>
          <th>Tokens per Call</th>
          <th>Cost per Call (CNY)</th>
          <th>Cache Hit Cost</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Paper/Patent/Journal/Scholar Search</td>
          <td>500</td>
          <td>¥0.01</td>
          <td>—</td>
      </tr>
      <tr>
          <td>Legal Cases</td>
          <td>5,000</td>
          <td>¥0.10</td>
          <td>¥0.05</td>
      </tr>
      <tr>
          <td>Law Articles</td>
          <td>5,000</td>
          <td>¥0.10</td>
          <td>¥0.05</td>
      </tr>
      <tr>
          <td>Law Catalog</td>
          <td>5,000</td>
          <td>¥0.10</td>
          <td>¥0.05</td>
      </tr>
      <tr>
          <td>Keyword Index</td>
          <td>5,000</td>
          <td>¥0.10</td>
          <td>¥0.05</td>
      </tr>
      <tr>
          <td>WeChat Index</td>
          <td>5,000</td>
          <td>¥0.10</td>
          <td>¥0.05</td>
      </tr>
      <tr>
          <td>Hot Rank</td>
          <td>5,000</td>
          <td>¥0.10</td>
          <td>¥0.05</td>
      </tr>
      <tr>
          <td>Express Tracking</td>
          <td>5,000</td>
          <td>¥0.10</td>
          <td>¥0.05</td>
      </tr>
      <tr>
          <td>Company Detail</td>
          <td>10,000</td>
          <td>¥0.20</td>
          <td>¥0.10</td>
      </tr>
      <tr>
          <td>Shixin/Zhixing Check</td>
          <td>10,000</td>
          <td>¥0.20</td>
          <td>¥0.10</td>
      </tr>
      <tr>
          <td>Tax Invoice Verification</td>
          <td>10,000</td>
          <td>¥0.20</td>
          <td>¥0.10</td>
      </tr>
      <tr>
          <td>Annual Report</td>
          <td>50,000</td>
          <td>¥1.00</td>
          <td>¥0.50</td>
      </tr>
  </tbody>
</table>
<h3 id="cache-hit-pricing">Cache Hit Pricing</h3>
<p>For endpoints that support cache hits, the cost is reduced by 50% when the same query has been made recently and the result is served from cache. This makes repeated queries — common in AI agent workflows that poll for updates — significantly more affordable.</p>
<h3 id="free-trial-quota">Free Trial Quota</h3>
<p>New accounts receive a free trial quota upon registration. This allows you to test all five data domains before committing to a paid plan. The trial quota is typically sufficient for several hundred legal case queries or thousands of academic research queries.</p>
<h2 id="mcp-server-integration">MCP Server Integration</h2>
<p>Beyond the Python SDK, Devnors Data also provides an MCP (Model Context Protocol) server that enables natural language data queries from AI assistants like Claude Desktop, Cursor, WorkBuddy, and Codex.</p>
<h3 id="remote-http-mode">Remote HTTP Mode</h3>
<p>In remote HTTP mode, the MCP server connects to Devnors Data&rsquo;s API gateway and exposes each data domain as a natural language tool:</p>



<div class="goat svg-container ">
  
    <svg
      xmlns="http://www.w3.org/2000/svg"
      font-family="Menlo,Lucida Console,monospace"
      
        viewBox="0 0 376 185"
      >
      <g transform='translate(8,16)'>
<text text-anchor='middle' x='0' y='4' fill='currentColor' style='font-size:1em'>#</text>
<text text-anchor='middle' x='0' y='20' fill='currentColor' style='font-size:1em'>{</text>
<text text-anchor='middle' x='0' y='164' fill='currentColor' style='font-size:1em'>}</text>
<text text-anchor='middle' x='16' y='4' fill='currentColor' style='font-size:1em'>C</text>
<text text-anchor='middle' x='16' y='36' fill='currentColor' style='font-size:1em'>"</text>
<text text-anchor='middle' x='16' y='148' fill='currentColor' style='font-size:1em'>}</text>
<text text-anchor='middle' x='24' y='4' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='24' y='36' fill='currentColor' style='font-size:1em'>m</text>
<text text-anchor='middle' x='32' y='4' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='32' y='36' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='32' y='52' fill='currentColor' style='font-size:1em'>"</text>
<text text-anchor='middle' x='32' y='132' fill='currentColor' style='font-size:1em'>}</text>
<text text-anchor='middle' x='40' y='4' fill='currentColor' style='font-size:1em'>u</text>
<text text-anchor='middle' x='40' y='36' fill='currentColor' style='font-size:1em'>p</text>
<text text-anchor='middle' x='40' y='52' fill='currentColor' style='font-size:1em'>d</text>
<text text-anchor='middle' x='48' y='4' fill='currentColor' style='font-size:1em'>d</text>
<text text-anchor='middle' x='48' y='36' fill='currentColor' style='font-size:1em'>S</text>
<text text-anchor='middle' x='48' y='52' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='48' y='68' fill='currentColor' style='font-size:1em'>"</text>
<text text-anchor='middle' x='48' y='84' fill='currentColor' style='font-size:1em'>"</text>
<text text-anchor='middle' x='48' y='116' fill='currentColor' style='font-size:1em'>}</text>
<text text-anchor='middle' x='56' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='56' y='36' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='56' y='52' fill='currentColor' style='font-size:1em'>v</text>
<text text-anchor='middle' x='56' y='68' fill='currentColor' style='font-size:1em'>u</text>
<text text-anchor='middle' x='56' y='84' fill='currentColor' style='font-size:1em'>h</text>
<text text-anchor='middle' x='64' y='36' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='64' y='52' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='64' y='68' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='64' y='84' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='64' y='100' fill='currentColor' style='font-size:1em'>"</text>
<text text-anchor='middle' x='72' y='4' fill='currentColor' style='font-size:1em'>D</text>
<text text-anchor='middle' x='72' y='36' fill='currentColor' style='font-size:1em'>v</text>
<text text-anchor='middle' x='72' y='52' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='72' y='68' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='72' y='84' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='72' y='100' fill='currentColor' style='font-size:1em'>A</text>
<text text-anchor='middle' x='80' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='80' y='36' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='80' y='52' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='80' y='68' fill='currentColor' style='font-size:1em'>"</text>
<text text-anchor='middle' x='80' y='84' fill='currentColor' style='font-size:1em'>d</text>
<text text-anchor='middle' x='80' y='100' fill='currentColor' style='font-size:1em'>u</text>
<text text-anchor='middle' x='88' y='4' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='88' y='36' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='88' y='52' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='88' y='68' fill='currentColor' style='font-size:1em'>:</text>
<text text-anchor='middle' x='88' y='84' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='88' y='100' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='96' y='4' fill='currentColor' style='font-size:1em'>k</text>
<text text-anchor='middle' x='96' y='36' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='96' y='52' fill='currentColor' style='font-size:1em'>-</text>
<text text-anchor='middle' x='96' y='84' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='96' y='100' fill='currentColor' style='font-size:1em'>h</text>
<text text-anchor='middle' x='104' y='4' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='104' y='36' fill='currentColor' style='font-size:1em'>"</text>
<text text-anchor='middle' x='104' y='52' fill='currentColor' style='font-size:1em'>d</text>
<text text-anchor='middle' x='104' y='68' fill='currentColor' style='font-size:1em'>"</text>
<text text-anchor='middle' x='104' y='84' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='104' y='100' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='112' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='112' y='36' fill='currentColor' style='font-size:1em'>:</text>
<text text-anchor='middle' x='112' y='52' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='112' y='68' fill='currentColor' style='font-size:1em'>h</text>
<text text-anchor='middle' x='112' y='84' fill='currentColor' style='font-size:1em'>"</text>
<text text-anchor='middle' x='112' y='100' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='120' y='4' fill='currentColor' style='font-size:1em'>p</text>
<text text-anchor='middle' x='120' y='52' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='120' y='68' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='120' y='84' fill='currentColor' style='font-size:1em'>:</text>
<text text-anchor='middle' x='120' y='100' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='128' y='36' fill='currentColor' style='font-size:1em'>{</text>
<text text-anchor='middle' x='128' y='52' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='128' y='68' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='128' y='100' fill='currentColor' style='font-size:1em'>z</text>
<text text-anchor='middle' x='136' y='4' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='136' y='52' fill='currentColor' style='font-size:1em'>"</text>
<text text-anchor='middle' x='136' y='68' fill='currentColor' style='font-size:1em'>p</text>
<text text-anchor='middle' x='136' y='84' fill='currentColor' style='font-size:1em'>{</text>
<text text-anchor='middle' x='136' y='100' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='144' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='144' y='52' fill='currentColor' style='font-size:1em'>:</text>
<text text-anchor='middle' x='144' y='68' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='144' y='100' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='152' y='4' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='152' y='68' fill='currentColor' style='font-size:1em'>:</text>
<text text-anchor='middle' x='152' y='100' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='160' y='4' fill='currentColor' style='font-size:1em'>f</text>
<text text-anchor='middle' x='160' y='52' fill='currentColor' style='font-size:1em'>{</text>
<text text-anchor='middle' x='160' y='68' fill='currentColor' style='font-size:1em'>/</text>
<text text-anchor='middle' x='160' y='100' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='168' y='4' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='168' y='68' fill='currentColor' style='font-size:1em'>/</text>
<text text-anchor='middle' x='168' y='100' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='176' y='4' fill='currentColor' style='font-size:1em'>g</text>
<text text-anchor='middle' x='176' y='68' fill='currentColor' style='font-size:1em'>d</text>
<text text-anchor='middle' x='176' y='100' fill='currentColor' style='font-size:1em'>"</text>
<text text-anchor='middle' x='184' y='4' fill='currentColor' style='font-size:1em'>u</text>
<text text-anchor='middle' x='184' y='68' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='184' y='100' fill='currentColor' style='font-size:1em'>:</text>
<text text-anchor='middle' x='192' y='4' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='192' y='68' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='200' y='4' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='200' y='68' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='200' y='100' fill='currentColor' style='font-size:1em'>"</text>
<text text-anchor='middle' x='208' y='4' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='208' y='68' fill='currentColor' style='font-size:1em'>.</text>
<text text-anchor='middle' x='208' y='100' fill='currentColor' style='font-size:1em'>B</text>
<text text-anchor='middle' x='216' y='4' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='216' y='68' fill='currentColor' style='font-size:1em'>d</text>
<text text-anchor='middle' x='216' y='100' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='224' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='224' y='68' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='224' y='100' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='232' y='4' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='232' y='68' fill='currentColor' style='font-size:1em'>v</text>
<text text-anchor='middle' x='232' y='100' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='240' y='68' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='240' y='100' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='248' y='68' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='248' y='100' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='256' y='68' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='264' y='68' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='264' y='100' fill='currentColor' style='font-size:1em'>Y</text>
<text text-anchor='middle' x='272' y='68' fill='currentColor' style='font-size:1em'>.</text>
<text text-anchor='middle' x='272' y='100' fill='currentColor' style='font-size:1em'>O</text>
<text text-anchor='middle' x='280' y='68' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='280' y='100' fill='currentColor' style='font-size:1em'>U</text>
<text text-anchor='middle' x='288' y='68' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='288' y='100' fill='currentColor' style='font-size:1em'>R</text>
<text text-anchor='middle' x='296' y='68' fill='currentColor' style='font-size:1em'>m</text>
<text text-anchor='middle' x='296' y='100' fill='currentColor' style='font-size:1em'>_</text>
<text text-anchor='middle' x='304' y='68' fill='currentColor' style='font-size:1em'>/</text>
<text text-anchor='middle' x='304' y='100' fill='currentColor' style='font-size:1em'>A</text>
<text text-anchor='middle' x='312' y='68' fill='currentColor' style='font-size:1em'>m</text>
<text text-anchor='middle' x='312' y='100' fill='currentColor' style='font-size:1em'>P</text>
<text text-anchor='middle' x='320' y='68' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='320' y='100' fill='currentColor' style='font-size:1em'>I</text>
<text text-anchor='middle' x='328' y='68' fill='currentColor' style='font-size:1em'>p</text>
<text text-anchor='middle' x='328' y='100' fill='currentColor' style='font-size:1em'>_</text>
<text text-anchor='middle' x='336' y='68' fill='currentColor' style='font-size:1em'>"</text>
<text text-anchor='middle' x='336' y='100' fill='currentColor' style='font-size:1em'>K</text>
<text text-anchor='middle' x='344' y='68' fill='currentColor' style='font-size:1em'>,</text>
<text text-anchor='middle' x='344' y='100' fill='currentColor' style='font-size:1em'>E</text>
<text text-anchor='middle' x='352' y='100' fill='currentColor' style='font-size:1em'>Y</text>
<text text-anchor='middle' x='360' y='100' fill='currentColor' style='font-size:1em'>"</text>
</g>

    </svg>
  
</div>
<p>Once configured, you can ask your AI assistant questions like &ldquo;Find recent patent infringement cases in Shanghai&rdquo; or &ldquo;What is the current WeChat index for large language models?&rdquo; and the assistant will query Devnors Data automatically.</p>
<h3 id="local-stdio-mode">Local stdio Mode</h3>
<p>For development environments, the MCP server can run locally via stdio:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>npx @devnors/mcp-server --api-key YOUR_API_KEY
</span></span></code></pre></div><p>This mode is useful for local testing and integration with development tools like Cursor and Codex.</p>
<h3 id="natural-language-query-examples">Natural Language Query Examples</h3>
<p>The MCP integration transforms complex API queries into simple natural language requests:</p>
<ul>
<li>&ldquo;Search for Chinese academic papers about reinforcement learning published in 2025&rdquo;</li>
<li>&ldquo;Check the shixin status of Beijing Tech Corp&rdquo;</li>
<li>&ldquo;What are the trending topics on Douyin today?&rdquo;</li>
<li>&ldquo;Find the full text of Article 20 of the Chinese Civil Code&rdquo;</li>
<li>&ldquo;Track express number SF1234567890&rdquo;</li>
</ul>
<p>This makes Devnors Data accessible to non-technical users and accelerates development by eliminating the need to read API documentation for every query.</p>
<h2 id="best-practices-for-ai-agents">Best Practices for AI Agents</h2>
<h3 id="api-key-management">API Key Management</h3>
<p>Store your API key in an environment variable (<code>DEVNORS_DATA_API_KEY</code>) rather than hardcoding it in source code. For AI agent deployments, use a secrets manager or encrypted environment file. The SDK&rsquo;s default behavior of reading from the environment encourages this best practice.</p>
<h3 id="pagination-for-large-result-sets">Pagination for Large Result Sets</h3>
<p>Always use the <code>paginate()</code> helper when you need complete results rather than a single page. The helper automatically respects rate limits and handles pagination state. For AI agents that need real-time responses, consider limiting page size and using the first page as a preview, then fetching additional pages in the background.</p>
<h3 id="retry-configuration">Retry Configuration</h3>
<p>The default retry settings (3 retries, 1-second initial delay, 2x backoff) work well for most use cases. For latency-sensitive AI agents, reduce <code>max_retries</code> to 1 or 2. For batch processing jobs where throughput matters more than latency, increase <code>max_retries</code> to 5 and set a longer initial delay.</p>
<h3 id="combining-multiple-data-domains-in-one-workflow">Combining Multiple Data Domains in One Workflow</h3>
<p>The unified API design makes it straightforward to combine data from multiple domains in a single AI agent workflow:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#f92672">from</span> devnors_data <span style="color:#f92672">import</span> DevnorsData
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>client <span style="color:#f92672">=</span> DevnorsData()
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># 1. Research a company</span>
</span></span><span style="display:flex;"><span>company <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>enterprise_company_detail(tax_id<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;91440101MA5...&#34;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># 2. Check for legal issues</span>
</span></span><span style="display:flex;"><span>cases <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>legal_cases(query<span style="color:#f92672">=</span>company<span style="color:#f92672">.</span>name, page<span style="color:#f92672">=</span><span style="color:#ae81ff">1</span>, page_size<span style="color:#f92672">=</span><span style="color:#ae81ff">5</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># 3. Check dishonesty blacklist</span>
</span></span><span style="display:flex;"><span>shixin <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>enterprise_shixin_check(company_name<span style="color:#f92672">=</span>company<span style="color:#f92672">.</span>name)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># 4. Find recent academic papers mentioning the company</span>
</span></span><span style="display:flex;"><span>papers <span style="color:#f92672">=</span> client<span style="color:#f92672">.</span>research_paper_search(query<span style="color:#f92672">=</span>company<span style="color:#f92672">.</span>name, page<span style="color:#f92672">=</span><span style="color:#ae81ff">1</span>, page_size<span style="color:#f92672">=</span><span style="color:#ae81ff">5</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># 5. Compile a comprehensive report</span>
</span></span><span style="display:flex;"><span>report <span style="color:#f92672">=</span> {
</span></span><span style="display:flex;"><span>    <span style="color:#e6db74">&#34;company_name&#34;</span>: company<span style="color:#f92672">.</span>name,
</span></span><span style="display:flex;"><span>    <span style="color:#e6db74">&#34;registration_status&#34;</span>: company<span style="color:#f92672">.</span>status,
</span></span><span style="display:flex;"><span>    <span style="color:#e6db74">&#34;legal_issues&#34;</span>: [c<span style="color:#f92672">.</span>title <span style="color:#66d9ef">for</span> c <span style="color:#f92672">in</span> cases<span style="color:#f92672">.</span>data],
</span></span><span style="display:flex;"><span>    <span style="color:#e6db74">&#34;blacklisted&#34;</span>: len(shixin<span style="color:#f92672">.</span>data) <span style="color:#f92672">&gt;</span> <span style="color:#ae81ff">0</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#e6db74">&#34;recent_mentions&#34;</span>: [p<span style="color:#f92672">.</span>title <span style="color:#66d9ef">for</span> p <span style="color:#f92672">in</span> papers<span style="color:#f92672">.</span>data]
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p>This pattern — querying legal, enterprise, and research data about a single entity — is a common AI agent workflow for due diligence, compliance checks, and market research.</p>
<h2 id="conclusion">Conclusion</h2>
<h3 id="why-devnors-data-is-ideal-for-china-focused-ai-agents">Why Devnors Data Is Ideal for China-Focused AI Agents</h3>
<p>Devnors Data solves a fundamental problem for AI agents operating in the Chinese market: accessing structured, traceable data from Chinese sources through a single integration. The Python SDK&rsquo;s design philosophy — thin wrapper over a unified gateway, automatic retry, pagination, async support — aligns perfectly with the needs of AI agent developers who want to minimize integration overhead and maximize reliability.</p>
<p>The platform&rsquo;s rapid expansion from a legal-only API to five data domains in one week demonstrates a commitment to becoming the comprehensive data layer for China-focused AI applications. With 68,787 legal cases indexed, enterprise registration data, social media trend tracking, logistics tracking, and academic research all available through one API key and one endpoint, Devnors Data significantly reduces the integration burden for AI agent developers.</p>
<h3 id="future-roadmap-and-expanding-data-coverage">Future Roadmap and Expanding Data Coverage</h3>
<p>Based on the platform&rsquo;s release cadence — five domains launched in a single week — we can expect continued rapid expansion. The changelog shows weekly feature releases, suggesting new data domains and endpoints are in active development. Potential future additions could include real-time financial data, government procurement records, real estate transaction data, and additional social media platforms.</p>
<p>For AI agent developers building for the Chinese market in 2026, the Devnors Data Python SDK is not just a convenience — it is rapidly becoming an essential tool in the stack.</p>
<h2 id="frequently-asked-questions">Frequently Asked Questions</h2>
<h3 id="what-is-the-devnors-data-python-sdk-and-what-does-it-do">What is the Devnors Data Python SDK and what does it do?</h3>
<p>The Devnors Data Python SDK (<code>devnors-data</code> on PyPI) is a client library that provides a unified interface to the Devnors Data API, which covers five data domains: legal cases, enterprise records, content indexes, cloud services, and academic research. It handles authentication, request serialization, automatic retry with exponential backoff, and pagination so developers can query Chinese data sources with minimal code.</p>
<h3 id="how-do-i-install-the-devnors-data-python-sdk">How do I install the Devnors Data Python SDK?</h3>
<p>Install it with <code>pip install devnors-data</code>. The package requires Python 3.9+ and depends on <code>httpx&gt;=0.24</code>. After installation, set your API key as the <code>DEVNORS_DATA_API_KEY</code> environment variable and create a <code>DevnorsData()</code> client instance to start querying data.</p>
<h3 id="what-data-domains-does-devnors-data-cover">What data domains does Devnors Data cover?</h3>
<p>Devnors Data covers five domains as of July 2026: legal (68,787 indexed cases, law articles, law catalog), enterprise (company detail, annual reports, tax invoice verification, shixin/zhixing checks), content (keyword index, WeChat index, hot rank), cloud services (express tracking), and academic research (papers, patents, journals, scholars).</p>
<h3 id="how-much-does-the-devnors-data-api-cost">How much does the Devnors Data API cost?</h3>
<p>Devnors Data uses pay-per-use pricing with no monthly fees. Academic research queries cost ¥0.01 per call (500 tokens), legal and content queries cost ¥0.10 per call (5,000 tokens), enterprise company detail costs ¥0.20 per call (10,000 tokens), and annual reports cost ¥1.00 per call (50,000 tokens). Cache hits reduce costs by 50%, and failed calls are automatically refunded.</p>
<h3 id="can-i-use-devnors-data-with-ai-assistants-like-claude-desktop">Can I use Devnors Data with AI assistants like Claude Desktop?</h3>
<p>Yes. Devnors Data provides an MCP (Model Context Protocol) server that integrates with Claude Desktop, Cursor, WorkBuddy, and Codex. You configure it with your API key, then query any data domain using natural language — for example, &ldquo;Find recent patent infringement cases in Shanghai&rdquo; or &ldquo;What is the current WeChat index for large language models?&rdquo;</p>
]]></content:encoded></item></channel></rss>