App development to tweet in Python from Visual Studio 2017

I tried to develop an application to tweet to Twitter in Visual Studio 2017 in Python. This time, I am creating an environment for the project using a virtual environment (venv).

environment

Windows 7 Professional SP1 64bit Visual Studio 2017 Community 15.2 (26430.6) Python 3.6.0 requests-oauthlib 0.8.0

Please refer to here for environment construction and Python project creation. http://qiita.com/akabei/items/a3b8b62f1cf34b683121

Project creation

Create a "Python application" from a new project.

bbb.png

Create virtual environment

Create a virtual environment (venv) when developing by changing the environment for each project. Right-click on the Python environment in Solution Explorer and select "Add Virtual Environment ..." from the menu.

ccc.png

A dialog will be displayed. Select the Python version used in the project and create a virtual environment.

ddd.png

A virtual environment "env" is created in the Python environment. The packages are still minimal.

eee.png

requests_oauthlib package installation

From the project's Python environment, right-click "env (Python 3.6 (64bit))" and select "Install Python Package ...".

fff.png

Type "requests-oauthlib" in the text box and select "Install requests-oauthlib (0.8.0)" to install the package.

ggg.png

The requests-oauthlib package and its dependent packages are installed in the env virtual environment.

hhh.png

Tweet

Write the program to tweet in tweet.py. Input completion (intellisense) cannot be used immediately after inserting the package, but it will be available after a while.

tweet.py


from requests_oauthlib import OAuth1Session

CONSUMER_KEY = 'xxxxxx'
CONSUMER_SECRET = 'xxxxxx'
ACCESS_TOKEN = 'xxxxxx'
ACCESS_SECRET = 'xxxxxx'

twitter = OAuth1Session(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_SECRET)
twitter.post("https://api.twitter.com/1.1/statuses/update.json", params={"status": "Tsuto Nau"})

Please run it and check if it was tweeted properly.

Recommended Posts

App development to tweet in Python from Visual Studio 2017
Python development in Visual Studio 2017
Python development in Visual Studio
Translator in Python from Visual Studio 2017 (Microsoft Translator Text API)
AWS SDK for Python (Boto3) development in Visual Studio 2017
How to debug the Python standard library in Visual Studio
Convert from Markdown to HTML in Python
Run Python in C ++ on Visual Studio 2017
How to hide the command prompt when running python in visual studio 2015
From re-environment construction of Python to graph drawing (on visual studio code)
Run Python YOLOv3 in C ++ on Visual Studio 2017
From file to graph drawing in Python. Elementary elementary
Settings for Python coding in Visual Studio Code
Changes from Python 3.0 to Python 3.5
Changes from Python 2 to Python 3.0
Framework development in Python
Development environment in Python
Slackbot development in Python
Create a Python development environment in 10 minutes (Mac OS X + Visual Studio Code)
Steps to put dlib in Python Tools for Visual Studio and have fun
How to install Google Test / Google Mock in Visual Studio 2019
Steps from installing Python 3 to creating a Django app
How to download files from Selenium in Python in Chrome
Python development environment with Windows + Anaconda3 + Visual Studio Code
Python development environment construction 2020 [From Python installation to poetry introduction]
Python development environment with Windows + Python + PipEnv + Visual Studio Code
Japanese output when dealing with python in visual studio
Install numpy in Visual Studio 2019
Post from Python to Slack
To flush stdout in Python
Cheating from PHP to Python
Login to website in Python
OCR from PDF in Python
Anaconda updated from 4.2.0 to 4.3.0 (python3.5 updated to python3.6)
Tweet with image in Python
Bottle Pug in Visual studio 2019
Switch from python2.7 to python3.6 (centos7)
Speech to speech in python [text to speech]
Connect to sqlite from python
How to develop in Python
Post to Slack in Python
How to use linux commands in Visual Studio Code terminal
I tried to create API list.csv in Python from swagger.yaml
Set up a Python development environment with Visual Studio Code
How to slice a block multiple array from a multiple array in Python
How to launch AWS Batch from a python client app
Do something like a Python interpreter in Visual Studio Code
How to sample from any probability density function in Python
Allow Python to select strings in input files from folders
Hit REST in Python to get data from New Relic
Call Matlab from Python to optimize
Learning history for participating in team app development in Python ~ Django Tutorial 5 ~
Learning history for participating in team app development in Python ~ Django Tutorial 4 ~
Convert markdown to PDF in Python
Get data from Quandl in Python
How to collect images in Python
Create folders from '01' to '12' with python
Web application development memo in python
Post from python to facebook timeline
How to use SQLite in Python
[Lambda] [Python] Post to Twitter from Lambda!