bitlance-ai-sdk 1.0.0__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.
@@ -0,0 +1,75 @@
1
+ Metadata-Version: 2.4
2
+ Name: bitlance-ai-sdk
3
+ Version: 1.0.0
4
+ Summary: Official Python SDK for the Bitlance SEO/GEO Content Generation API
5
+ Home-page: https://github.com/bitlance/bitlance-ai-python
6
+ Author: Bitlance Automation
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.7
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: requests>=2.25.0
13
+ Dynamic: author
14
+ Dynamic: classifier
15
+ Dynamic: description
16
+ Dynamic: description-content-type
17
+ Dynamic: home-page
18
+ Dynamic: requires-dist
19
+ Dynamic: requires-python
20
+ Dynamic: summary
21
+
22
+ # Bitlance AI Python SDK
23
+
24
+ The official Python SDK for the Bitlance SEO/GEO Content Generation API.
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ pip install bitlance-ai-sdk
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ ```python
35
+ from bitlance_ai import BitlanceAI
36
+
37
+ ai = BitlanceAI(api_key="YOUR_API_KEY")
38
+
39
+ def main():
40
+ try:
41
+ # 1. Generate Topics
42
+ topics = ai.generate_topics(industry="Real Estate", mode="SEO")
43
+ print("Topics:", topics)
44
+
45
+ # 2. Generate SEO Article
46
+ seo_article = ai.generate_seo({
47
+ "topic": "How to Invest in Commercial Real Estate in 2026",
48
+ "keywords": "commercial real estate, investment tips",
49
+ "length": "Long (1500+ words)"
50
+ })
51
+ print("Title:", seo_article.get("title"))
52
+
53
+ # 3. Generate GEO Article
54
+ geo_article = ai.generate_geo({
55
+ "topic": "Enterprise AI Adoption Maturity Model",
56
+ })
57
+ print("Schema:", geo_article.get("schema_markup"))
58
+
59
+ # 4. Audit Content
60
+ audit = ai.audit_content("Your content here...", target_keyword="AI Adoption", mode="GEO")
61
+ print("Audit:", audit.get("audit_report"))
62
+
63
+ # 5. Rewrite Content
64
+ rewritten = ai.rewrite_content("Your content here...", instructions="Add more hard statistics", mode="GEO")
65
+ print("Rewritten:", rewritten.get("rewritten_content"))
66
+
67
+ except Exception as e:
68
+ print("Error:", str(e))
69
+
70
+ if __name__ == "__main__":
71
+ main()
72
+ ```
73
+
74
+ ## Error Handling
75
+ The SDK automatically retries on network failures and `429 Too Many Requests` errors using exponential backoff (up to 3 retries). Client errors like `401 Unauthorized` or `402 Payment Required` will immediately raise a `BitlanceAIError`.
@@ -0,0 +1,54 @@
1
+ # Bitlance AI Python SDK
2
+
3
+ The official Python SDK for the Bitlance SEO/GEO Content Generation API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install bitlance-ai-sdk
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```python
14
+ from bitlance_ai import BitlanceAI
15
+
16
+ ai = BitlanceAI(api_key="YOUR_API_KEY")
17
+
18
+ def main():
19
+ try:
20
+ # 1. Generate Topics
21
+ topics = ai.generate_topics(industry="Real Estate", mode="SEO")
22
+ print("Topics:", topics)
23
+
24
+ # 2. Generate SEO Article
25
+ seo_article = ai.generate_seo({
26
+ "topic": "How to Invest in Commercial Real Estate in 2026",
27
+ "keywords": "commercial real estate, investment tips",
28
+ "length": "Long (1500+ words)"
29
+ })
30
+ print("Title:", seo_article.get("title"))
31
+
32
+ # 3. Generate GEO Article
33
+ geo_article = ai.generate_geo({
34
+ "topic": "Enterprise AI Adoption Maturity Model",
35
+ })
36
+ print("Schema:", geo_article.get("schema_markup"))
37
+
38
+ # 4. Audit Content
39
+ audit = ai.audit_content("Your content here...", target_keyword="AI Adoption", mode="GEO")
40
+ print("Audit:", audit.get("audit_report"))
41
+
42
+ # 5. Rewrite Content
43
+ rewritten = ai.rewrite_content("Your content here...", instructions="Add more hard statistics", mode="GEO")
44
+ print("Rewritten:", rewritten.get("rewritten_content"))
45
+
46
+ except Exception as e:
47
+ print("Error:", str(e))
48
+
49
+ if __name__ == "__main__":
50
+ main()
51
+ ```
52
+
53
+ ## Error Handling
54
+ The SDK automatically retries on network failures and `429 Too Many Requests` errors using exponential backoff (up to 3 retries). Client errors like `401 Unauthorized` or `402 Payment Required` will immediately raise a `BitlanceAIError`.
@@ -0,0 +1,108 @@
1
+ import requests
2
+ import time
3
+ from typing import Dict, Any, Optional
4
+
5
+ class BitlanceAIError(Exception):
6
+ pass
7
+
8
+ class BitlanceAI:
9
+ def __init__(self, api_key: str, base_url: str = "https://api.bitlancetechhub.com/api/v1", max_retries: int = 3, timeout: int = 300):
10
+ if not api_key:
11
+ raise ValueError("BitlanceAI: api_key is required")
12
+ self.api_key = api_key
13
+ self.base_url = base_url.rstrip("/")
14
+ self.max_retries = max_retries
15
+ self.timeout = timeout
16
+ self.session = requests.Session()
17
+ self.session.headers.update({
18
+ "Authorization": f"Bearer {self.api_key}",
19
+ "Content-Type": "application/json"
20
+ })
21
+
22
+ def _request(self, method: str, endpoint: str, json_data: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
23
+ url = f"{self.base_url}{endpoint}"
24
+ attempt = 0
25
+
26
+ while attempt < self.max_retries:
27
+ try:
28
+ response = self.session.request(method, url, json=json_data, timeout=self.timeout)
29
+ response.raise_for_status()
30
+ return response.json()
31
+ except requests.exceptions.HTTPError as e:
32
+ attempt += 1
33
+ status = e.response.status_code
34
+ # Do not retry client errors except 429
35
+ if 400 <= status < 500 and status != 429:
36
+ raise BitlanceAIError(f"Bitlance API Error ({status}): {e.response.text}")
37
+
38
+ if attempt >= self.max_retries:
39
+ raise BitlanceAIError(f"Bitlance API Error: Max retries reached. {str(e)}")
40
+
41
+ except requests.exceptions.RequestException as e:
42
+ attempt += 1
43
+ if attempt >= self.max_retries:
44
+ raise BitlanceAIError(f"Bitlance API Error: Max retries reached. {str(e)}")
45
+
46
+ # Exponential backoff
47
+ time.sleep(2 ** attempt)
48
+
49
+ def generate_topics(self, industry: str, mode: str = "SEO", location: Optional[str] = "Global", goal: Optional[str] = "Lead Generation") -> Dict[str, Any]:
50
+ if not industry:
51
+ raise ValueError("industry is required")
52
+ return self._request("POST", "/topic/generate", {
53
+ "industry": industry,
54
+ "mode": mode,
55
+ "location": location,
56
+ "goal": goal
57
+ })
58
+
59
+ def generate_seo(self, params: Dict[str, Any]) -> Dict[str, Any]:
60
+ if not params.get("topic") and not params.get("industry"):
61
+ raise ValueError("topic or industry is required")
62
+ return self._request("POST", "/seo/generate", params)
63
+
64
+ def generate_geo(self, params: Dict[str, Any]) -> Dict[str, Any]:
65
+ if not params.get("topic") and not params.get("industry"):
66
+ raise ValueError("topic or industry is required")
67
+ return self._request("POST", "/geo/generate", params)
68
+
69
+ def audit_content(self, content: str, target_keyword: Optional[str] = None, mode: str = "SEO") -> Dict[str, Any]:
70
+ if not content:
71
+ raise ValueError("content is required")
72
+ return self._request("POST", "/content/audit", {
73
+ "content": content,
74
+ "target_keyword": target_keyword,
75
+ "mode": mode
76
+ })
77
+
78
+ def rewrite_content(self, content: str, instructions: Optional[str] = None, mode: str = "SEO") -> Dict[str, Any]:
79
+ if not content:
80
+ raise ValueError("content is required")
81
+ return self._request("POST", "/content/rewrite", {
82
+ "content": content,
83
+ "instructions": instructions,
84
+ "mode": mode
85
+ })
86
+
87
+ def track_keyword(self, article_url: str, target_keyword: str, optimization_mode: str = "SEO") -> Dict[str, Any]:
88
+ return self._request("POST", "/tracking/keywords", {
89
+ "article_url": article_url,
90
+ "target_keyword": target_keyword,
91
+ "optimization_mode": optimization_mode
92
+ })
93
+
94
+ def get_tracked_keywords(self) -> Dict[str, Any]:
95
+ return self._request("GET", "/tracking/keywords")
96
+
97
+ def poll_ai_visibility(self, target_keyword: str, expected_url: str) -> Dict[str, Any]:
98
+ return self._request("POST", "/tracking/ai-visibility/poll", {
99
+ "target_keyword": target_keyword,
100
+ "expected_url": expected_url
101
+ })
102
+
103
+ def predict_traffic(self, search_volume: int, current_position: int, topic_growth_rate: float = 1.0) -> Dict[str, Any]:
104
+ return self._request("POST", "/tracking/predict-traffic", {
105
+ "search_volume": search_volume,
106
+ "current_position": current_position,
107
+ "topic_growth_rate": topic_growth_rate
108
+ })
@@ -0,0 +1,75 @@
1
+ Metadata-Version: 2.4
2
+ Name: bitlance-ai-sdk
3
+ Version: 1.0.0
4
+ Summary: Official Python SDK for the Bitlance SEO/GEO Content Generation API
5
+ Home-page: https://github.com/bitlance/bitlance-ai-python
6
+ Author: Bitlance Automation
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.7
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: requests>=2.25.0
13
+ Dynamic: author
14
+ Dynamic: classifier
15
+ Dynamic: description
16
+ Dynamic: description-content-type
17
+ Dynamic: home-page
18
+ Dynamic: requires-dist
19
+ Dynamic: requires-python
20
+ Dynamic: summary
21
+
22
+ # Bitlance AI Python SDK
23
+
24
+ The official Python SDK for the Bitlance SEO/GEO Content Generation API.
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ pip install bitlance-ai-sdk
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ ```python
35
+ from bitlance_ai import BitlanceAI
36
+
37
+ ai = BitlanceAI(api_key="YOUR_API_KEY")
38
+
39
+ def main():
40
+ try:
41
+ # 1. Generate Topics
42
+ topics = ai.generate_topics(industry="Real Estate", mode="SEO")
43
+ print("Topics:", topics)
44
+
45
+ # 2. Generate SEO Article
46
+ seo_article = ai.generate_seo({
47
+ "topic": "How to Invest in Commercial Real Estate in 2026",
48
+ "keywords": "commercial real estate, investment tips",
49
+ "length": "Long (1500+ words)"
50
+ })
51
+ print("Title:", seo_article.get("title"))
52
+
53
+ # 3. Generate GEO Article
54
+ geo_article = ai.generate_geo({
55
+ "topic": "Enterprise AI Adoption Maturity Model",
56
+ })
57
+ print("Schema:", geo_article.get("schema_markup"))
58
+
59
+ # 4. Audit Content
60
+ audit = ai.audit_content("Your content here...", target_keyword="AI Adoption", mode="GEO")
61
+ print("Audit:", audit.get("audit_report"))
62
+
63
+ # 5. Rewrite Content
64
+ rewritten = ai.rewrite_content("Your content here...", instructions="Add more hard statistics", mode="GEO")
65
+ print("Rewritten:", rewritten.get("rewritten_content"))
66
+
67
+ except Exception as e:
68
+ print("Error:", str(e))
69
+
70
+ if __name__ == "__main__":
71
+ main()
72
+ ```
73
+
74
+ ## Error Handling
75
+ The SDK automatically retries on network failures and `429 Too Many Requests` errors using exponential backoff (up to 3 retries). Client errors like `401 Unauthorized` or `402 Payment Required` will immediately raise a `BitlanceAIError`.
@@ -0,0 +1,8 @@
1
+ README.md
2
+ setup.py
3
+ bitlance_ai/__init__.py
4
+ bitlance_ai_sdk.egg-info/PKG-INFO
5
+ bitlance_ai_sdk.egg-info/SOURCES.txt
6
+ bitlance_ai_sdk.egg-info/dependency_links.txt
7
+ bitlance_ai_sdk.egg-info/requires.txt
8
+ bitlance_ai_sdk.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ requests>=2.25.0
@@ -0,0 +1 @@
1
+ bitlance_ai
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,21 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="bitlance-ai-sdk",
5
+ version="1.0.0",
6
+ description="Official Python SDK for the Bitlance SEO/GEO Content Generation API",
7
+ long_description=open("README.md").read(),
8
+ long_description_content_type="text/markdown",
9
+ author="Bitlance Automation",
10
+ url="https://github.com/bitlance/bitlance-ai-python",
11
+ packages=find_packages(),
12
+ install_requires=[
13
+ "requests>=2.25.0",
14
+ ],
15
+ classifiers=[
16
+ "Programming Language :: Python :: 3",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent",
19
+ ],
20
+ python_requires=">=3.7",
21
+ )