Skip to content

Commit 52c791a

Browse files
committed
refactor: rename api module and update import paths
1 parent 900e053 commit 52c791a

File tree

5 files changed

+28
-27
lines changed

5 files changed

+28
-27
lines changed

README.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -63,32 +63,32 @@ grok/
6363
```python
6464
import sys
6565
import os
66+
6667
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
67-
from api.GrokAI import GrokAI, GrokAccount
68+
from pygrokai.GrokAI import GrokAI, GrokAccount
6869
from rich.console import Console
6970

70-
7171
with open(r'path/to/cookies.txt', 'r') as f:
72-
cookies = {}
73-
for line in f:
74-
if line.strip(): # Ignore empty lines
75-
key, value = line.strip().split('=', 1)
76-
cookies[key] = value
72+
cookies = {}
73+
for line in f:
74+
if line.strip(): # Ignore empty lines
75+
key, value = line.strip().split('=', 1)
76+
cookies[key] = value
7777

7878
# Example cookies dictionary
7979
#
80-
#cookie_name1': 'cookie_value1',
81-
#'cookie_name2': 'cookie_value2',
80+
# cookie_name1': 'cookie_value1',
81+
# 'cookie_name2': 'cookie_value2',
8282
# # Add more cookies as needed
8383
# }
8484

8585
account = GrokAccount(
86-
cookies=cookies,
87-
headers={
88-
'accept': '*/*',
89-
'content-type': 'application/json',
90-
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/134.0.0.0 Safari/537.36'
91-
},
86+
cookies=cookies,
87+
headers={
88+
'accept': '*/*',
89+
'content-type': 'application/json',
90+
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/134.0.0.0 Safari/537.36'
91+
},
9292
)
9393

9494
# Initialize the GrokAI instance
@@ -99,17 +99,17 @@ console = Console()
9999
console.print("Sending message to Grok AI...", style="bold green")
100100

101101
try:
102-
grok_ai.Chat(
103-
disableSearch=False,
104-
enableImageGeneration=True,
105-
isReasoning=False,
106-
NewChat=True,
107-
meassge="please generate a picture of a cat",
108-
debug=True,
109-
110-
)
102+
grok_ai.Chat(
103+
disableSearch=False,
104+
enableImageGeneration=True,
105+
isReasoning=False,
106+
NewChat=True,
107+
meassge="please generate a picture of a cat",
108+
debug=True,
109+
110+
)
111111
except Exception as e:
112-
console.print(f"An error occurred: {e}", style="bold red")
112+
console.print(f"An error occurred: {e}", style="bold red")
113113
```
114114

115115
```text documents
File renamed without changes.
File renamed without changes.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ python = "^3.7"
2626
cloudscraper = "^1.2.71"
2727
rich = "^13.4.2"
2828

29-
[tool.poetry.dev-dependencies]
29+
[tool.poetry.group.dev.dependencies]
3030
pytest = "^7.4.0"
3131

3232
[build-system]
3333
requires = ["poetry-core>=1.0.0"]
3434
build-backend = "poetry.core.masonry.api"
35+
pytest = "^7.4.0"

test/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
import os
33
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
4-
from api.GrokAI import GrokAI, GrokAccount
4+
from pygrokai.GrokAI import GrokAI, GrokAccount
55
from rich.console import Console
66

77

0 commit comments

Comments
 (0)