Skip to content
This repository was archived by the owner on Sep 29, 2023. It is now read-only.

Commit ea423a4

Browse files
authored
Merge pull request #5 from optimizely/py3_compatible
Py3 compatible
2 parents 9ac0d86 + baefb14 commit ea423a4

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

.gitignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
### Python ###
2+
# Byte-compiled / optimized / DLL files
3+
__pycache__/
4+
*.py[cod]
5+
*$py.class
6+
7+
8+
# Installer logs
9+
pip-log.txt
10+
pip-delete-this-directory.txt
11+
12+
# Unit test / coverage reports
13+
htmlcov/
14+
.tox/
15+
.coverage
16+
.coverage.*
17+
.cache
18+
.pytest_cache/
19+
nosetests.xml
20+
coverage.xml
21+
*.cover
22+
.hypothesis/
23+
24+
# Environments
25+
.env
26+
.venv
27+
env/
28+
venv*/
29+
ENV/
30+
env.bak/
31+
venv.bak/

application.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Python SDK Demo App
22
# Copyright 2016 Optimizely. Licensed under the Apache License
33
# View the documentation: http://optimize.ly/py-sdk
4+
from __future__ import print_function
45

56
import csv
67
import json
@@ -50,12 +51,12 @@ def shop():
5051

5152
# sort by price
5253
if variation_key == 'price':
53-
print "In variation 1"
54+
print("In variation 1")
5455
sorted_items = sorted(sorted_items, key=itemgetter('price'))
5556

5657
# sort by category
5758
if variation_key == 'category':
58-
print "In variation 2"
59+
print("In variation 2")
5960
sorted_items = sorted(sorted_items, key=itemgetter('category'))
6061

6162
return render_template('index.html',

test_webhook.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import print_function
2+
13
import requests
24
import json
35

@@ -8,4 +10,4 @@
810

911
r = requests.post("http://127.0.0.1:4001/webhook", data=json.dumps(data), headers={'Content-Type': 'application/json'})
1012

11-
print r.text
13+
print(r.text)

0 commit comments

Comments
 (0)