forked from tweepy/tweepy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbasic_auth.py
25 lines (19 loc) · 966 Bytes
/
basic_auth.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import tweepy
# === Basic Authentication ===
#
# *Note: Basic Authentication is deprecated and no longer supported on Twitter.
# It is still provided for use in services like Status.net which still suppports it.*
#
# This mode of authentication requires the user provide their username and plain text password.
# These credentials will then be provided for each request to the API for authentication.
# You would normally fetch this in your application
# by asking the user or loading from some dark place.
username = ""
password = ""
# Create an authentication handler passing it the username and password.
# We will use this object later on when creating our API object.
auth = tweepy.auth.BasicAuthHandler(username, password)
# Create the API object providing it the authentication handler to use.
# Each request will then be authenticated using this handler.
api = tweepy.API(auth)
api.update_status('Updating using basic authentication via Tweepy!')