Skip to content

Commit a7022a5

Browse files
Add more details to basic examples in "usage.md" docs page
1 parent 7051b93 commit a7022a5

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

docs/usage.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ based on a given title.
6565
```python
6666
from simplejustwatchapi import search
6767

68-
results = search("The Matrix", "US", "en", 5, True, 0, {"nfx", "apv"})
68+
results = search("The Matrix", "US", "en", 5, True, 0, ["nfx", "apv"])
69+
for entry in results:
70+
print(entry.title, entry.offers)
6971
```
7072

7173
All arguments are optional.
@@ -95,7 +97,9 @@ currently popular titles.
9597
```python
9698
from simplejustwatchapi import popular
9799

98-
results = popular("US", "en", 5, True, 0, {"nfx", "apv"})
100+
results = popular("US", "en", 5, True, 0, ["nfx", "apv"])
101+
for entry in results:
102+
print(entry.title, entry.offers)
99103
```
100104

101105
All arguments are optional.
@@ -122,7 +126,8 @@ for a single entry via its node ID.
122126
```python
123127
from simplejustwatchapi import details
124128

125-
results = details("tm19698", "US", "en", False)
129+
result = details("tm19698", "US", "en", False)
130+
print(result.title, result.short_description)
126131
```
127132

128133
Node ID can be taken from output of the [`search`](#search-for-a-title) function.
@@ -160,6 +165,8 @@ for all seasons of a TV show based on its node ID.
160165
from simplejustwatchapi import seasons
161166

162167
results = seasons("tss20091", "US", "en", True)
168+
for season in results:
169+
print(season.season_number, season.total_episode_count)
163170
```
164171

165172
Only the first argument is required - the node ID of a TV show to look up season
@@ -175,9 +182,11 @@ Example function call and its output is in
175182
details for all episodes of a single TV show season based on its node ID.
176183

177184
```python
178-
from simplejustwatchapi import seasons
185+
from simplejustwatchapi import episodes
179186

180187
results = episodes("tse334769", "US", "en", False)
188+
for episode in results:
189+
print(episode.episode_id, episode.episode_number, episode.offers)
181190
```
182191

183192
Only the first argument is required - the node ID of a season to look up episode details
@@ -202,6 +211,10 @@ Only offers are returned, not additional data.
202211
from simplejustwatchapi import offers_for_countries
203212

204213
results = offers_for_countries("tm10", {"US", "UK", "CA"}, "en", True)
214+
for country, offers in results.items():
215+
print(f"Offers for {country}:")
216+
for offer in offers:
217+
print(f" - {offer.package.name}: {offer.monetization_type}")
205218
```
206219

207220
First two arguments are required - ID, and a set of country codes.
@@ -220,6 +233,11 @@ given country.
220233
from simplejustwatchapi import providers
221234

222235
results = providers("US")
236+
netflix_apple_only = [
237+
provider
238+
for provider in all_providers
239+
if provider.name in ("Netflix", "Apple TV")
240+
]
223241
```
224242

225243
Returned value is a list of [`OfferPackage`][simplejustwatchapi.tuples.OfferPackage].

0 commit comments

Comments
 (0)