PandaAPI 1.0.2__tar.gz → 1.0.4__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,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PandaAPI
3
- Version: 1.0.2
3
+ Version: 1.0.4
4
4
  Summary: Python utility hub by @ll_PANDA_BBY_ll
5
5
  Author: PANDA
6
6
  Author-email:
7
- License: MIT
7
+ License-Expression: MIT
8
8
  Keywords: python,PandaAPI,telegram,bot
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Classifier: Operating System :: OS Independent
@@ -41,7 +41,7 @@ from PandaAPI import api
41
41
  print(api.password(16))
42
42
 
43
43
  # GitHub user info
44
- print(api.github("nikhil390u8o"))
44
+ print(api.github("octocat"))
45
45
 
46
46
  # AI
47
47
  print(api.gemini("Hello!"))
@@ -2,12 +2,13 @@ import requests
2
2
  import json
3
3
 
4
4
 
5
+ GEMINI_KEY = "AQ.Ab8RN6JORDWFSVSJUzMxcmvKqCA4qW5GBJMwDicXWun9vGsPpQ"
6
+
7
+
5
8
  def gemini(prompt: str) -> dict:
6
- # gemini-2.0-flash free tier
7
9
  url = (
8
10
  "https://generativelanguage.googleapis.com/v1beta/models/"
9
- "gemini-2.0-flash:generateContent"
10
- "?key=AIzaSyBQaoUF-KWjPV_4ABtSN0DQ0RPkNeCh4tM"
11
+ f"gemini-2.0-flash:generateContent?key={GEMINI_KEY}"
11
12
  )
12
13
  payload = {"contents": [{"parts": [{"text": prompt}]}]}
13
14
  try:
@@ -20,6 +21,13 @@ def gemini(prompt: str) -> dict:
20
21
  if r.status_code == 200:
21
22
  text = r.json()["candidates"][0]["content"]["parts"][0]["text"]
22
23
  return {"result": text, "success": True}
24
+ # fallback to pollinations if key fails
25
+ r2 = requests.get(
26
+ f"https://text.pollinations.ai/{requests.utils.quote(prompt)}?model=openai",
27
+ timeout=20,
28
+ )
29
+ if r2.status_code == 200:
30
+ return {"result": r2.text.strip(), "success": True}
23
31
  return {"success": False, "error": r.text}
24
32
  except Exception as e:
25
33
  return {"success": False, "error": str(e)}
@@ -27,16 +35,8 @@ def gemini(prompt: str) -> dict:
27
35
 
28
36
  def chatgpt(prompt: str) -> dict:
29
37
  try:
30
- url = "https://api.intelligence.io.solutions/api/v1/chat/completions"
31
- headers = {
32
- "Authorization": "Bearer io-v2-eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJvd25lcl9pZCI6IjZjZWIxZTZkLWI4MjItNDJkMi05NjY3LTc3Nzk5OTRlNGI3YiIsImtleV9pZCI6IjhiNDVhYTk1LWM2OWUtNDI1OS1hMmQwLTI0MjFmNzYyM2JjZCJ9.dummy",
33
- "Content-Type": "application/json",
34
- }
35
- # fallback to a working free provider
36
- url = "https://api.openai.com/v1/chat/completions"
37
- # use pollinations free API instead
38
38
  r = requests.get(
39
- f"https://text.pollinations.ai/{requests.utils.quote(prompt)}",
39
+ f"https://text.pollinations.ai/{requests.utils.quote(prompt)}?model=openai",
40
40
  timeout=20,
41
41
  )
42
42
  if r.status_code == 200:
@@ -47,10 +47,9 @@ def chatgpt(prompt: str) -> dict:
47
47
 
48
48
 
49
49
  def blackbox(prompt: str) -> dict:
50
- # use pollinations with blackbox model
51
50
  try:
52
51
  r = requests.get(
53
- f"https://text.pollinations.ai/{requests.utils.quote(prompt)}?model=blackboxai",
52
+ f"https://text.pollinations.ai/{requests.utils.quote(prompt)}?model=mistral",
54
53
  timeout=20,
55
54
  )
56
55
  if r.status_code == 200:
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PandaAPI
3
- Version: 1.0.2
3
+ Version: 1.0.4
4
4
  Summary: Python utility hub by @ll_PANDA_BBY_ll
5
5
  Author: PANDA
6
6
  Author-email:
7
- License: MIT
7
+ License-Expression: MIT
8
8
  Keywords: python,PandaAPI,telegram,bot
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Classifier: Operating System :: OS Independent
@@ -41,7 +41,7 @@ from PandaAPI import api
41
41
  print(api.password(16))
42
42
 
43
43
  # GitHub user info
44
- print(api.github("nikhil390u8o"))
44
+ print(api.github("octocat"))
45
45
 
46
46
  # AI
47
47
  print(api.gemini("Hello!"))
@@ -23,7 +23,7 @@ from PandaAPI import api
23
23
  print(api.password(16))
24
24
 
25
25
  # GitHub user info
26
- print(api.github("nikhil390u8o"))
26
+ print(api.github("octocat"))
27
27
 
28
28
  # AI
29
29
  print(api.gemini("Hello!"))
@@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "PandaAPI"
7
- version = "1.0.2"
7
+ version = "1.0.4"
8
8
  authors = [
9
9
  { name = "PANDA" }
10
10
  ]
11
11
  description = "Python utility hub by @ll_PANDA_BBY_ll"
12
12
  readme = "README.md"
13
- license = { text = "MIT" }
13
+ license = "MIT"
14
14
  requires-python = ">=3.8"
15
15
  keywords = ["python", "PandaAPI", "telegram", "bot"]
16
16
  classifiers = [
File without changes
File without changes
File without changes
File without changes