|
@ -1644,7 +1644,7 @@ def send_page(sport): |
|
|
def odds_handler(sport): |
|
|
def odds_handler(sport): |
|
|
team = request.forms.get('team') |
|
|
team = request.forms.get('team') |
|
|
home_odds, away_odds = 2.44, 3.29 |
|
|
home_odds, away_odds = 2.44, 3.29 |
|
|
response.headers['Content-Type'] ='application/json' |
|
|
|
|
|
|
|
|
response.headers['Content-Type'] = 'application/json' |
|
|
response.headers['Cache-Control'] = 'no-cache' |
|
|
response.headers['Cache-Control'] = 'no-cache' |
|
|
return json.dumps([team, home_odds, away_odds]) |
|
|
return json.dumps([team, home_odds, away_odds]) |
|
|
``` |
|
|
``` |
|
@ -1653,7 +1653,7 @@ def odds_handler(sport): |
|
|
```python |
|
|
```python |
|
|
# $ pip3 install requests |
|
|
# $ pip3 install requests |
|
|
>>> import requests |
|
|
>>> import requests |
|
|
>>> url = 'http://localhost:8080/odds/football' |
|
|
|
|
|
|
|
|
>>> url = 'http://localhost:8080/odds/football' |
|
|
>>> data = {'team': 'arsenal f.c.'} |
|
|
>>> data = {'team': 'arsenal f.c.'} |
|
|
>>> response = requests.post(url, data=data) |
|
|
>>> response = requests.post(url, data=data) |
|
|
>>> response.json() |
|
|
>>> response.json() |
|
@ -1713,7 +1713,7 @@ Line # Hits Time Per Hit % Time Line Contents |
|
|
```python |
|
|
```python |
|
|
# $ pip3 install pycallgraph |
|
|
# $ pip3 install pycallgraph |
|
|
from pycallgraph import output, PyCallGraph |
|
|
from pycallgraph import output, PyCallGraph |
|
|
from datetime import datetime |
|
|
|
|
|
|
|
|
from datetime import datetime |
|
|
time_str = datetime.now().strftime('%Y%m%d%H%M%S') |
|
|
time_str = datetime.now().strftime('%Y%m%d%H%M%S') |
|
|
filename = f'profile-{time_str}.png' |
|
|
filename = f'profile-{time_str}.png' |
|
|
drawer = output.GraphvizOutput(output_file=filename) |
|
|
drawer = output.GraphvizOutput(output_file=filename) |
|
|