{"action":"created","issue":{"url":"https://api.github.com/repos/tweepy/tweepy/issues/572","labels_url":"https://api.github.com/repos/tweepy/tweepy/issues/572/labels{/name}","comments_url":"https://api.github.com/repos/tweepy/tweepy/issues/572/comments","events_url":"https://api.github.com/repos/tweepy/tweepy/issues/572/events","html_url":"https://github.com/tweepy/tweepy/issues/572","id":60808976,"number":572,"title":"OAuth problems with new account","user":{"login":"scififacts","id":11440313,"avatar_url":"https://avatars.githubusercontent.com/u/11440313?v=3","gravatar_id":"","url":"https://api.github.com/users/scififacts","html_url":"https://github.com/scififacts","followers_url":"https://api.github.com/users/scififacts/followers","following_url":"https://api.github.com/users/scififacts/following{/other_user}","gists_url":"https://api.github.com/users/scififacts/gists{/gist_id}","starred_url":"https://api.github.com/users/scififacts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scififacts/subscriptions","organizations_url":"https://api.github.com/users/scififacts/orgs","repos_url":"https://api.github.com/users/scififacts/repos","events_url":"https://api.github.com/users/scififacts/events{/privacy}","received_events_url":"https://api.github.com/users/scififacts/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-12T12:05:57Z","updated_at":"2015-03-16T11:54:20Z","closed_at":null,"body":"I am using tweepy for a bot that I have written. The code is simple but I am receiving 401 errors when it posts the status. I have regenerated my keys and even deleted the app on Twitter. Failures occur whether I'm running Python 2.7 or 3.4.\r\n\r\nI have followed many threads already, with no luck. Any suggestions would be greatly appreciated.\r\n\r\nThe code:\r\n\r\nimport tweepy, datetime, sqlite3\r\n\r\nCONSUMER_KEY = ‘xxxxx’\r\nCONSUMER_SECRET = ‘xxxxx’ # Make sure access level is Read And Write\r\nACCESS_KEY = ‘xxxxx’\r\nACCESS_SECRET = ‘xxxxx’\r\nauth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)\r\nauth.secure = True  # This was not in the original script, but seems to make no difference.\r\nauth.set_access_token(ACCESS_KEY, ACCESS_SECRET)\r\napi = tweepy.API(auth)\r\n\r\nnow = datetime.datetime.now()\r\n\r\ndbconn = sqlite3.connect(‘/pathname/db’)\r\ndbconn.row_factory = sqlite3.Row\r\nc = dbconn.cursor()\r\nc.execute('SELECT * FROM tweets ORDER BY RANDOM() LIMIT 1')\r\nr = c.fetchone()\r\ntweet = r[2]\r\n\r\napi.update_status(tweet)\r\n\r\nThe error:\r\n\r\nTraceback (most recent call last):\r\n  File \"/pathname/script.py\", line 35, in <module>\r\n    api.update_status(tweet)\r\n  File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tweepy/api.py\", line 193, in update_status\r\n    )(post_data=post_data, *args, **kwargs)\r\n  File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tweepy/binder.py\", line 239, in _call\r\n    return method.execute()\r\n  File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tweepy/binder.py\", line 223, in execute\r\n    raise TweepError(error_msg, resp)\r\ntweepy.error.TweepError: Twitter error response: status code = 401"},"comment":{"url":"https://api.github.com/repos/tweepy/tweepy/issues/comments/81603671","html_url":"https://github.com/tweepy/tweepy/issues/572#issuecomment-81603671","issue_url":"https://api.github.com/repos/tweepy/tweepy/issues/572","id":81603671,"user":{"login":"syndbg","id":6031925,"avatar_url":"https://avatars.githubusercontent.com/u/6031925?v=3","gravatar_id":"","url":"https://api.github.com/users/syndbg","html_url":"https://github.com/syndbg","followers_url":"https://api.github.com/users/syndbg/followers","following_url":"https://api.github.com/users/syndbg/following{/other_user}","gists_url":"https://api.github.com/users/syndbg/gists{/gist_id}","starred_url":"https://api.github.com/users/syndbg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syndbg/subscriptions","organizations_url":"https://api.github.com/users/syndbg/orgs","repos_url":"https://api.github.com/users/syndbg/repos","events_url":"https://api.github.com/users/syndbg/events{/privacy}","received_events_url":"https://api.github.com/users/syndbg/received_events","type":"User","site_admin":false},"created_at":"2015-03-16T11:54:20Z","updated_at":"2015-03-16T11:54:20Z","body":"Could you try to do the same thing, using the https://dev.twitter.com/rest/tools/console ? Are you still getting 401'd?"}}