summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-05-18 23:13:57 +0200
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-05-18 23:13:57 +0200
commit9ddac1715f7d656ebcf0bc4d0247e9bfd32626fa (patch)
tree4a137ca4958a81272e37f952b9330a197038f83f /README.md
parentFix OpenaiChat provider, improve proofofwork (diff)
downloadgpt4free-9ddac1715f7d656ebcf0bc4d0247e9bfd32626fa.tar
gpt4free-9ddac1715f7d656ebcf0bc4d0247e9bfd32626fa.tar.gz
gpt4free-9ddac1715f7d656ebcf0bc4d0247e9bfd32626fa.tar.bz2
gpt4free-9ddac1715f7d656ebcf0bc4d0247e9bfd32626fa.tar.lz
gpt4free-9ddac1715f7d656ebcf0bc4d0247e9bfd32626fa.tar.xz
gpt4free-9ddac1715f7d656ebcf0bc4d0247e9bfd32626fa.tar.zst
gpt4free-9ddac1715f7d656ebcf0bc4d0247e9bfd32626fa.zip
Diffstat (limited to 'README.md')
-rw-r--r--README.md30
1 files changed, 25 insertions, 5 deletions
diff --git a/README.md b/README.md
index 3fc3cddb..970206f7 100644
--- a/README.md
+++ b/README.md
@@ -236,19 +236,39 @@ set_cookies(".google.com", {
})
```
-Alternatively, you can place your .har and cookie files in the `/har_and_cookies` directory. To export a cookie file, use the EditThisCookie extension available on the Chrome Web Store: [EditThisCookie Extension](https://chromewebstore.google.com/detail/editthiscookie/fngmhnnpilhplaeedifhccceomclgfbg).
+#### Using .har and Cookie Files
-You can also create .har files to capture cookies. If you need further assistance, refer to the next section.
+You can place `.har` and cookie files in the default `./har_and_cookies` directory. To export a cookie file, use the [EditThisCookie Extension](https://chromewebstore.google.com/detail/editthiscookie/fngmhnnpilhplaeedifhccceomclgfbg) available on the Chrome Web Store.
-```bash
-python -m g4f.cli api --debug
+#### Creating .har Files to Capture Cookies
+
+To capture cookies, you can also create `.har` files. For more details, refer to the next section.
+
+#### Changing the Cookies Directory and Loading Cookie Files in Python
+
+You can change the cookies directory and load cookie files in your Python environment. To set the cookies directory relative to your Python file, use the following code:
+
+```python
+import os.path
+from g4f.cookies import set_cookies_dir, read_cookie_files
+
+import g4f.debug
+g4f.debug.logging = True
+
+cookies_dir = os.path.join(os.path.dirname(__file__), "har_and_cookies")
+set_cookies_dir(cookies_dir)
+read_cookie_files(cookies_dir)
```
+
+### Debug Mode
+
+If you enable debug mode, you will see logs similar to the following:
+
```
Read .har file: ./har_and_cookies/you.com.har
Cookies added: 10 from .you.com
Read cookie file: ./har_and_cookies/google.json
Cookies added: 16 from .google.com
-Starting server... [g4f v-0.0.0] (debug)
```
#### .HAR File for OpenaiChat Provider