Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python syntax highlighting to README.md #604

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 48 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,19 @@ Only good until Google changes their backend again :-P. When that happens feel f

### Connect to Google

from pytrends.request import TrendReq
```python
from pytrends.request import TrendReq

pytrends = TrendReq(hl='en-US', tz=360)
pytrends = TrendReq(hl='en-US', tz=360)
```

or if you want to use proxies as you are blocked due to Google rate limit:

```python
from pytrends.request import TrendReq

from pytrends.request import TrendReq

pytrends = TrendReq(hl='en-US', tz=360, timeout=(10,25), proxies=['https://34.203.233.13:80',], retries=2, backoff_factor=0.1, requests_args={'verify':False})
pytrends = TrendReq(hl='en-US', tz=360, timeout=(10,25), proxies=['https://34.203.233.13:80',], retries=2, backoff_factor=0.1, requests_args={'verify':False})
```

* `timeout(connect, read)`
- See explantation on this on [requests docs](https://requests.readthedocs.io/en/master/user/advanced/#timeouts)
Expand Down Expand Up @@ -87,8 +90,10 @@ Note: the parameter `hl` specifies host language for accessing Google Trends.
Note: only https proxies will work, and you need to add the port number after the proxy ip address

### Build Payload
kw_list = ["Blockchain"]
pytrends.build_payload(kw_list, cat=0, timeframe='today 5-y', geo='', gprop='')
```python
kw_list = ["Blockchain"]
pytrends.build_payload(kw_list, cat=0, timeframe='today 5-y', geo='', gprop='')
```

Parameters

Expand Down Expand Up @@ -203,24 +208,30 @@ Many API methods use the following:

### Interest Over Time

pytrends.interest_over_time()
```python
pytrends.interest_over_time()
```

Returns pandas.Dataframe

<sub><sup>[back to top](#interest_over_time)</sub></sup>

### Multirange Interest Over Time

pytrends.build_payload(kw_list=['pizza', 'bagel'], timeframe=['2022-09-04 2022-09-10', '2022-09-18 2022-09-24']))
pytrends.multirange_interest_over_time()
```python
pytrends.build_payload(kw_list=['pizza', 'bagel'], timeframe=['2022-09-04 2022-09-10', '2022-09-18 2022-09-24']))
pytrends.multirange_interest_over_time()
```

Returns pandas.Dataframe. It includes the average in the first row.

<sub><sup>[back to top](#multirange_interest_over_time)</sub></sup>

### Historical Hourly Interest

pytrends.get_historical_interest(kw_list, year_start=2018, month_start=1, day_start=1, hour_start=0, year_end=2018, month_end=2, day_end=1, hour_end=0, cat=0, geo='', gprop='', sleep=0)
```python
pytrends.get_historical_interest(kw_list, year_start=2018, month_start=1, day_start=1, hour_start=0, year_end=2018, month_end=2, day_end=1, hour_end=0, cat=0, geo='', gprop='', sleep=0)
```

Parameters

Expand All @@ -243,7 +254,9 @@ Returns pandas.Dataframe

### Interest by Region

pytrends.interest_by_region(resolution='COUNTRY', inc_low_vol=True, inc_geo_code=False)
```python
pytrends.interest_by_region(resolution='COUNTRY', inc_low_vol=True, inc_geo_code=False)
```

Parameters

Expand All @@ -268,41 +281,51 @@ Returns pandas.DataFrame

### Related Topics

pytrends.related_topics()
```python
pytrends.related_topics()
```

Returns dictionary of pandas.DataFrames

<sub><sup>[back to top](#related_topics)</sub></sup>

### Related Queries

pytrends.related_queries()
```python
pytrends.related_queries()
```

Returns dictionary of pandas.DataFrames

<sub><sup>[back to top](#related_queries)</sub></sup>

### Trending Searches

pytrends.trending_searches(pn='united_states') # trending searches in real time for United States
pytrends.trending_searches(pn='japan') # Japan
```python
pytrends.trending_searches(pn='united_states') # trending searches in real time for United States
pytrends.trending_searches(pn='japan') # Japan
```

Returns pandas.DataFrame

<sub><sup>[back to top](#trending_searches)</sub></sup>

### Realtime Search Trends

pytrends.realtime_trending_searches(pn='US') # realtime search trends for United States
pytrends.realtime_trending_searches(pn='IN') # India
```python
pytrends.realtime_trending_searches(pn='US') # realtime search trends for United States
pytrends.realtime_trending_searches(pn='IN') # India
```

Returns pandas.DataFrame

<sub><sup>[back to top](#realtime-search-trends)</sub></sup>

### Top Charts

pytrends.top_charts(date, hl='en-US', tz=300, geo='GLOBAL')
```python
pytrends.top_charts(date, hl='en-US', tz=300, geo='GLOBAL')
```

Parameters

Expand All @@ -320,7 +343,9 @@ Returns pandas.DataFrame

### Suggestions

pytrends.suggestions(keyword)
```python
pytrends.suggestions(keyword)
```

Parameters

Expand All @@ -335,7 +360,9 @@ Returns dictionary

### Categories

pytrends.categories()
```python
pytrends.categories()
```

Returns dictionary

Expand Down