-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix eventlet example from not running.
- Loading branch information
1 parent
ab2bcc0
commit 4fe9d8b
Showing
4 changed files
with
8 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
import requests | ||
|
||
from celery import task | ||
from celery import shared_task | ||
|
||
|
||
@task() | ||
@shared_task() | ||
def urlopen(url): | ||
print(f'-open: {url}') | ||
try: | ||
response = requests.get(url) | ||
except requests.exceptions.RequestException as exc: | ||
print(f'-url {url} gave error: {exc!r}') | ||
return | ||
return len(response.text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters