Skip to content

Commit c9702ee

Browse files
committed
Adding config stub for twitter auth (required for Twitter API 1.1)
1 parent 68d5771 commit c9702ee

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

‎ch06/twitterauth.py‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This code is supporting material for the book
2+
# Building Machine Learning Systems with Python
3+
# by Willi Richert and Luis Pedro Coelho
4+
# published by PACKT Publishing
5+
#
6+
# It is made available under the MIT License
7+
8+
import sys
9+
10+
CONSUMER_KEY = None
11+
CONSUMER_SECRET = None
12+
13+
ACCESS_TOKEN_KEY = None
14+
ACCESS_TOKEN_SECRET = None
15+
16+
if CONSUMER_KEY is None or CONSUMER_SECRET is None or ACCESS_TOKEN_KEY is None or ACCESS_TOKEN_SECRET is None:
17+
print("""\
18+
When doing last code sanity checks for the book, Twitter
19+
was using the API 1.0, which did not require authentication.
20+
With its switch to version 1.1, this has now changed.
21+
22+
It seems that you don't have already created your personal Twitter
23+
access keys and tokens. Please do so at
24+
https://dev.twitter.com/docs/auth/tokens-devtwittercom
25+
and paste the keys/secrets into twitterauth.py
26+
27+
Sorry for the inconvenience,
28+
The authors.""")
29+
30+
sys.exit(1)

0 commit comments

Comments
 (0)