pytrends-modern 0.2.1__tar.gz → 0.2.2__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.
Files changed (33) hide show
  1. {pytrends_modern-0.2.1/pytrends_modern.egg-info → pytrends_modern-0.2.2}/PKG-INFO +9 -4
  2. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/README.md +8 -3
  3. pytrends_modern-0.2.2/examples/example_docker_usage.py +50 -0
  4. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/pyproject.toml +1 -1
  5. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/pytrends_modern/__init__.py +1 -1
  6. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/pytrends_modern/browser_config_camoufox.py +5 -3
  7. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2/pytrends_modern.egg-info}/PKG-INFO +9 -4
  8. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/pytrends_modern.egg-info/SOURCES.txt +1 -0
  9. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/LICENSE +0 -0
  10. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/MANIFEST.in +0 -0
  11. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/examples/advanced_usage.py +0 -0
  12. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/examples/basic_usage.py +0 -0
  13. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/examples/example_browser_mode.py +0 -0
  14. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/examples/test_async_integration.py +0 -0
  15. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/pytrends_modern/browser_config.py +0 -0
  16. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/pytrends_modern/camoufox_setup.py +0 -0
  17. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/pytrends_modern/cli.py +0 -0
  18. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/pytrends_modern/config.py +0 -0
  19. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/pytrends_modern/exceptions.py +0 -0
  20. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/pytrends_modern/proxy_extension.py +0 -0
  21. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/pytrends_modern/py.typed +0 -0
  22. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/pytrends_modern/request.py +0 -0
  23. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/pytrends_modern/request_async.py +0 -0
  24. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/pytrends_modern/rss.py +0 -0
  25. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/pytrends_modern/scraper.py +0 -0
  26. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/pytrends_modern/utils.py +0 -0
  27. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/pytrends_modern.egg-info/dependency_links.txt +0 -0
  28. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/pytrends_modern.egg-info/entry_points.txt +0 -0
  29. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/pytrends_modern.egg-info/requires.txt +0 -0
  30. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/pytrends_modern.egg-info/top_level.txt +0 -0
  31. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/setup.cfg +0 -0
  32. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/tests/conftest.py +0 -0
  33. {pytrends_modern-0.2.1 → pytrends_modern-0.2.2}/tests/test_basic.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytrends-modern
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Modern Google Trends API - Combining the best of pytrends, with RSS feeds, Selenium scraping, DrissionPage browser automation, and enhanced features
5
5
  Author: pytrends-modern contributors
6
6
  License: MIT
@@ -175,11 +175,16 @@ RUN mkdir -p /root/.config && \
175
175
  cd /root/.config && \
176
176
  tar -xzf /tmp/profile.tar.gz
177
177
 
178
- # 3. Use headless mode in container
179
- config = BrowserConfig(headless=True)
178
+ # 3. Use headless="virtual" in container
179
+ config = BrowserConfig(headless="virtual") # Use Xvfb for Docker
180
180
  ```
181
181
 
182
- See `Dockerfile.example` for complete Docker setup.
182
+ **Headless Options:**
183
+ - `headless=False` - Show browser window (local development)
184
+ - `headless=True` - Standard headless (servers with display)
185
+ - `headless="virtual"` - Xvfb virtual display (Docker containers)
186
+
187
+ See `Dockerfile.example` and `examples/example_docker_usage.py` for complete Docker setup.
183
188
 
184
189
  ⚠️ **Security**: Profile contains Google session - keep secure, don't commit to git!
185
190
 
@@ -125,11 +125,16 @@ RUN mkdir -p /root/.config && \
125
125
  cd /root/.config && \
126
126
  tar -xzf /tmp/profile.tar.gz
127
127
 
128
- # 3. Use headless mode in container
129
- config = BrowserConfig(headless=True)
128
+ # 3. Use headless="virtual" in container
129
+ config = BrowserConfig(headless="virtual") # Use Xvfb for Docker
130
130
  ```
131
131
 
132
- See `Dockerfile.example` for complete Docker setup.
132
+ **Headless Options:**
133
+ - `headless=False` - Show browser window (local development)
134
+ - `headless=True` - Standard headless (servers with display)
135
+ - `headless="virtual"` - Xvfb virtual display (Docker containers)
136
+
137
+ See `Dockerfile.example` and `examples/example_docker_usage.py` for complete Docker setup.
133
138
 
134
139
  ⚠️ **Security**: Profile contains Google session - keep secure, don't commit to git!
135
140
 
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Example: Using pytrends-modern in Docker containers
4
+
5
+ When running in Docker, use headless="virtual" to enable Xvfb virtual display.
6
+ This prevents display errors in containerized environments.
7
+ """
8
+
9
+ import asyncio
10
+ from pytrends_modern import AsyncTrendReq, BrowserConfig
11
+
12
+
13
+ async def main():
14
+ """Example async usage in Docker container"""
15
+
16
+ # Configure for Docker environment
17
+ config = BrowserConfig(
18
+ headless="virtual", # Use Xvfb virtual display for Docker
19
+ humanize=True,
20
+ os='linux',
21
+ geoip=True
22
+ )
23
+
24
+ # For local development, use:
25
+ # config = BrowserConfig(headless=False) # Show browser window
26
+ # config = BrowserConfig(headless=True) # Standard headless
27
+
28
+ print("🐳 Running pytrends-modern in Docker container...")
29
+ print(f"📁 Profile: {config.user_data_dir}")
30
+
31
+ async with AsyncTrendReq(browser_config=config) as pytrends:
32
+ pytrends.kw_list = ["Docker"]
33
+
34
+ # Get interest over time
35
+ print("\n📊 Fetching interest_over_time...")
36
+ df = await pytrends.interest_over_time()
37
+ print(f"✓ Got {len(df)} rows")
38
+ print(df.head())
39
+
40
+ # Get interest by region
41
+ print("\n🌍 Fetching interest_by_region...")
42
+ df_region = await pytrends.interest_by_region()
43
+ print(f"✓ Got {len(df_region)} rows")
44
+ print(df_region.head())
45
+
46
+ print("\n✅ Complete!")
47
+
48
+
49
+ if __name__ == "__main__":
50
+ asyncio.run(main())
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pytrends-modern"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "Modern Google Trends API - Combining the best of pytrends, with RSS feeds, Selenium scraping, DrissionPage browser automation, and enhanced features"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -2,7 +2,7 @@
2
2
  pytrends-modern: Modern Google Trends API
3
3
  """
4
4
 
5
- __version__ = "0.2.1"
5
+ __version__ = "0.2.2"
6
6
  __author__ = "pytrends-modern contributors"
7
7
  __license__ = "MIT"
8
8
 
@@ -1,6 +1,6 @@
1
1
  """Browser configuration for Camoufox automation"""
2
2
 
3
- from typing import Optional
3
+ from typing import Optional, Union
4
4
  import os as os_module
5
5
 
6
6
 
@@ -18,7 +18,9 @@ class BrowserConfig:
18
18
 
19
19
  Args:
20
20
  headless: Run browser in headless mode (default: False)
21
- Set to 'virtual' on Linux to use Xvfb
21
+ - False: Show browser window (for local development)
22
+ - True: Standard headless mode (for servers with display)
23
+ - 'virtual': Use Xvfb virtual display (for Docker containers)
22
24
  proxy_server: Proxy server URL (e.g., 'http://proxy.com:8080')
23
25
  proxy_username: Proxy username (for authenticated proxies)
24
26
  proxy_password: Proxy password (for authenticated proxies)
@@ -47,7 +49,7 @@ class BrowserConfig:
47
49
 
48
50
  def __init__(
49
51
  self,
50
- headless: bool = False,
52
+ headless: Union[bool, str] = False,
51
53
  proxy_server: Optional[str] = None,
52
54
  proxy_username: Optional[str] = None,
53
55
  proxy_password: Optional[str] = None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytrends-modern
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Modern Google Trends API - Combining the best of pytrends, with RSS feeds, Selenium scraping, DrissionPage browser automation, and enhanced features
5
5
  Author: pytrends-modern contributors
6
6
  License: MIT
@@ -175,11 +175,16 @@ RUN mkdir -p /root/.config && \
175
175
  cd /root/.config && \
176
176
  tar -xzf /tmp/profile.tar.gz
177
177
 
178
- # 3. Use headless mode in container
179
- config = BrowserConfig(headless=True)
178
+ # 3. Use headless="virtual" in container
179
+ config = BrowserConfig(headless="virtual") # Use Xvfb for Docker
180
180
  ```
181
181
 
182
- See `Dockerfile.example` for complete Docker setup.
182
+ **Headless Options:**
183
+ - `headless=False` - Show browser window (local development)
184
+ - `headless=True` - Standard headless (servers with display)
185
+ - `headless="virtual"` - Xvfb virtual display (Docker containers)
186
+
187
+ See `Dockerfile.example` and `examples/example_docker_usage.py` for complete Docker setup.
183
188
 
184
189
  ⚠️ **Security**: Profile contains Google session - keep secure, don't commit to git!
185
190
 
@@ -5,6 +5,7 @@ pyproject.toml
5
5
  examples/advanced_usage.py
6
6
  examples/basic_usage.py
7
7
  examples/example_browser_mode.py
8
+ examples/example_docker_usage.py
8
9
  examples/test_async_integration.py
9
10
  pytrends_modern/__init__.py
10
11
  pytrends_modern/browser_config.py
File without changes