Skip to content

Instantly share code, notes, and snippets.

@aoshiman
Last active August 29, 2015 14:06
Show Gist options
  • Save aoshiman/4725d9a903f4af88a761 to your computer and use it in GitHub Desktop.
Save aoshiman/4725d9a903f4af88a761 to your computer and use it in GitHub Desktop.
Tweet via Twython(Python3.4)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from twython import Twython, TwythonError
from pit import Pit
def main(post):
"""Function for OAuth Setting and Tweet"""
oauth_conf = Pit.get('oauth_conf')
access_conf = Pit.get('access_conf')
twitter = Twython(
oauth_conf['consumer_key'],
oauth_conf['consumer_secret'],
access_conf['access_token'],
access_conf['access_secret']
)
try:
twitter.update_status(status = post)
except TwythonError as e:
print(e)
if __name__ == '__main__':
main(' '.join(sys.argv[1:]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment