Tweet (API 1.1) on Google App Engine for Python

http://offsidenow.phpapps.jp/archives/1664

・ Python2.7 ・ TwitterAPI1.1 ・ OAuth library (https://github.com/mikeknapp/AppEngine-OAuth-Library)

tweet.py


#!/usr/bin/env python
# -*- coding:utf-8 -*-

from google.appengine.ext import webapp

#Specify each information obtained earlier here
TWITTER_CONSUMER_KEY = 'Consumer key'
TWITTER_CONSUMER_SECRET = 'Consumer secret'
TWITTER_ACCESS_TOKEN = 'Access token'
TWITTER_ACCESS_TOKEN_SECRET = 'Access token secret'

class TweetHandler(webapp.RequestHandler):
  def get(self):
    from extends.GAE_Oauth import oauth
    client = oauth.TwitterClient(TWITTER_CONSUMER_KEY,
                                 TWITTER_CONSUMER_SECRET, None)
    tweet = u"Good morning"
    param = {'status': tweet}
    client.make_request('https://api.twitter.com/1.1/statuses/update.json',
                        token=TWITTER_ACCESS_TOKEN,
                        secret=TWITTER_ACCESS_TOKEN_SECRET,
                        additional_params=param,
                        protected=True,
                        method='POST')
    self.response.out.write(tweet)

Recommended Posts

Tweet (API 1.1) on Google App Engine for Python
PIL with Python on Windows 8 (for Google App Engine)
[Python] Run Flask on Google App Engine
Deploy a Django application on Google App Engine (Python3)
Getting Started with Google App Engine for Python & PHP
How to use Django on Google App Engine / Python
Use ndb.tasklet on Google App Engine
Google Cloud Vision API sample for python
Use external modules on Google App Engine
Use Django's ImageField on App Engine / Python
Publish the site for free on Google App Engine (personal memorandum)
Do you have any recommendations for a commentary book on Google App Engine / Python development?
Deploy a Python app on Google App Engine and integrate it with GitHub
Google App Engine Datastore and Search API integration
Google App Engine / Python development environment construction procedure (late 2014)
(Beginner) Basic usage of Datastore on Google App Engine
Runtime version of Google App Engine / Python Standard Environment
Qt for Python app self-update
Google Drive Api Tips (Python)
Until you run a Flask application on Google App Engine for the time being
Various memorandums when using sdk of LINE Messaging API with Python (2.7.9) + Google App Engine
Hello World with Google App Engine (Java 8) + Servlet API 3.1 + Gradle
Access google spreadsheet using python on raspberry pi (for myself)
Deploy your Go app on Google App Engine with GitHub Actions
Get data from analytics API with Google API Client for python
[Python] Hit the Google Translation API
[Python3] Google translate google translate without using api
Google App Engine development with Docker
Java 1 1 support from Google App Engine
Install confluent-kafka for Python on Ubuntu
Use Google Analytics API from Python
[Memo] Tweet on twitter with python
Stream speech recognition using Google Cloud Speech gRPC API on python3 on Mac!
Settings when writing Google App Engine / Python apps in Intellij Idea
Building a development environment with Maven on Google App Engine [Java]
Using properties files with Flexible Environment Java 8 on Google App Engine
Notes for using OpenCV on Windows10 Python 3.8.3.
[google-oauth] [python] Google APIs Client Library for Python
Run Cloud Dataflow (Python) from App Engine
Notes on nfc.ContactlessFrontend () for nfcpy in python
Tweet using the Twitter API in Python
Get Google Fit API data in Python
[Google App Engine] User Objects (Japanese translation)
Use Google Cloud Vision API from Python
Make Qt for Python app a desktop app
I can't deploy with google app engine
Edit Slide (PowerPoint for Google) with Python (Low-cost RPA case with Google API and Python)
Creating Google Spreadsheet using Python / Google Data API
Implemented Python wrapper for Qiita API v2
Data acquisition from analytics API with Google API Client for python Part 2 Web application
About the problem that the python version of Google App Engine does not mesh
How to use Service Account OAuth and API with Google API Client for python
Check when the HTML obtained by Requests on Google App Engine is garbled
Created a Python wrapper for the Qiita API
(Windows) Causes and workarounds for UnicodeEncodeError on Python 3
Run Google Analytics API (core v3) in python
Tips for hitting the ATND API in Python
A memorandum for touching python Flask on heroku
My thoughts on python2.6 command line app template
Build Python3 + flask environment on GCP Compute Engine
THORLABS camera CS2100M-USB runs on Python [for research]