Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add Basic Authentication example.

  • Loading branch information...
commit 801c81e109f60df40a2a8594933f152949ea96a3 1 parent cf4ebd0
Joshua Roesslein joshthecoder authored

Showing 1 changed file with 25 additions and 0 deletions. Show diff stats Hide diff stats

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

0 comments on commit 801c81e

Please sign in to comment.
Something went wrong with that request. Please try again.