Extract Data from Meetup.com using Python

Certainly Meetup.com is upcoming brand. It have lot of information regarding human behavior, for instance, what kind of groups people are making!, what are interest of people for particular region etc.

Extracting this type of information for analysis will be a great punch. Developing good applications on the basis of this data can fetch you good number of bucks.

Meetup.com to Python


Using Python to extract data from Meetup.com

  • Create your account with Meetup.com
  • Authentication your Key and Secret using OAuth library
  • Go to Meet Up Console
  • Choose which method you need, fill the blocks and click 'show response'
  • You will get signed url
  • Directly request a call to this url
  • You will get the data.
  • Store this in JSON format in an object and send it you Database

Souce Code of Python to extract Meetup Data

#-------------------------------------------------------------------------------
# Name:        module1
# Purpose:
#
# Author:      Muskan
#
# Created:     17-06-2015
# Copyright:   (c) Muskan 2015
# Licence:     <your licence>
#-------------------------------------------------------------------------------
import urllib
import requests_oauthlib
from requests_oauthlib import OAuth1Session
import json
import oauthlib
from pymongo import MongoClient
def connect_db():
    client = MongoClient('localhost', 27017)
    db = client['meetup']
    collection = db['trypost_topics']
    return collection

def main():
    pass

if __name__ == '__main__':
    main()

#create db connection
cursor = connect_db()
meetup = OAuth1Session('your_key',
                            client_secret='your_secret',
                            callback_uri="https://127.0.0.1/callback")
current_page_topics="https://api.meetup.com/topics?offset=0&format=json&photo-host=public&page=500&order=members&sig_id=<signedid>&sig=<sign>"
print meetup

web_response = urllib.urlopen(current_page_topics)
json_postdata = web_response.read()
json_postdata=json.loads(json_postdata)

print json_postdata
print type(json_postdata)
cursor.insert(json_postdata)

This can also be performed for developer's API of other websites

Comments

Popular posts from this blog

Different Fields for Data Science

Different types of clustering for textual documents

Significance of Woman in Data Science