We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ac5d571 + 1bb1972 commit 40da260Copy full SHA for 40da260
src/textual/demo/home.py
@@ -1,7 +1,12 @@
1
import asyncio
2
from importlib.metadata import version
3
4
-import httpx
+try:
5
+ import httpx
6
+
7
+ HTTPX_AVAILABLE = True
8
+except ImportError:
9
+ HTTPX_AVAILABLE = False
10
11
from textual import work
12
from textual.app import ComposeResult
@@ -152,6 +157,12 @@ class StarCount(Vertical):
152
157
@work
153
158
async def get_stars(self):
154
159
"""Worker to get stars from GitHub API."""
160
+ if not HTTPX_AVAILABLE:
161
+ self.notify(
162
+ "Install httpx to update stars from the GitHub API.\n\n$ [b]pip install httpx[/b]",
163
+ title="GitHub Stars",
164
+ )
165
+ return
155
166
self.loading = True
156
167
try:
168
await asyncio.sleep(1) # Time to admire the loading indicator
0 commit comments