Thursday, April 19, 2018

How to import/export database in MySQL workbench

  • Open MySQL Workbench. To take database backup you have localhost or server. 
  • Select instance on which you are working or on which your database present.
  • If you want to create server database click on plus '+' symbol to create a server as shown in the following screenshot.

How to Export Database

  • Click on management tab on the left side navigation panel. 
  • Click on 'Data Export'.
  • Select schema/database which you want to export or take backup. then click on 'start export'. As shown in the following screenshot.





  • Before import database, you should have schema or database with that name which you are importing. If you don't have that schema then create the schema as shown in the following screenshot.


  • Click on management tab on the left side navigation panel. 
  • Click on 'Data Import'
  • Select database dumb folder to import.
  • Click on 'Start Import'. As shown in following screenshot.




Monday, April 16, 2018

How to integrate twitter API with python

Twitter is online news and social networking site where people communicate in short messages called tweets. Tweeting is sending short messages to anyone who follows you on Twitter, with the hope that your messages are useful and interesting to someone in your audience. Another description of Twitter and tweeting might be microblogging.

Most people know Twitter as " the website that lets you send out short online updates." Twitter is a full-fledged social media platform that lets people connect with one another, share information in real time, marketing in business and is defined by its real-time nature. You can send out messages about events as they happen with immediate feedback.

All these stuff we are doing from the website or mobile app, but you can also manage your account by programmatically using twitter API through python to get someone's public profile, tweet someone, and all many things.

You can do following things using this Twitter API with the python library (Tweepy)


  1. Manage personal as well as company profile information.
  2. Post or share updates, tweets, media and URL on Twitter.
  3. Fetch latest updates and post from personal as well as users profile.
  4. Fetch information of the user.
  5. Search user and follow them.
  6. Search user and create the friendship.
  7. Send a direct message to the user.
  8. There are many things you can do using Twitter API with python.
In order to use the TweePy API client, you first need to acquire a set of application tokens. These will be your consumer_key and consumer_secret, which get passed to twitter.API() when starting your application.

Create your app

First, you should have a twitter account. If not sign up on Twitter. Then create a Twitter app. Click the "Create New App" button and fill out the fields on the next page.

Create New App
You will be redirected to application creation page. Fill out all required information and accept developer agreement, Then click on "create your Twitter application".

Create Twitter App


Your App


Once your application is created, you'll be redirected to the new page showing you some
information about it.


Your API key and secret key


Click on the "Keys and Access Tokens" tab on the top there, just under the green notification in the image above. You will get API key and secret key.

Note - Do not share API key and secret key to other



Click on "create my access token" to generate access token key and access token secret key.


How to use in the python script?

The python library Tweepy provides easy access to the Twitter API. The simplest means of acquiring Tweepy is using pip, a python package management system.

First, Install pip

sudo apt-get update && sudo apt-get install python-pip

Install Tweepy using pip

pip install tweepy

After successful creating your Twitter application and generating the necessary keys and tokens, you are now ready to create your client application for managing twitter account. In this step, we provide you a simple python script to test your application.

Create a new file called twitter.py

You can give any name to py file. Paste the following script into twitter.py. Replace keys and secrets with our unique credentials from the Twitter apps website.



Save the file, then run the script using the following command.

python twitter.py

Check your Twitter account. If the status posts to your account's timeline, then you have successfully configured your Twitter application and authenticated using Tweepy.