Giter Club home page Giter Club logo

computing4liberalarts.py's Introduction

computing4liberalarts.py

A working repository for ideas for a course

This repository currently contains a bare minimum that I could distill from internet resources to access the Twitter search API. We could use this for investigating the feasibility to include twitter data in the course "Computing in Liberal Arts".

##Install

This is a Python package, in order to install clone this repository using git (and git-crypt:

git clone https://github.com/davidavdav/computing4liberalarts.py.git
cd computing4liberalarts

Unlocking the secret twitter key

It is necessary to unlock an encrypted file containing the credentials for accessing the twitter search API from an application only authentication perspective. You can do this my sending me your gpg public key. Assuming you have created a gpg private/public key pair, you can extract the public key using:

gpg --armor --export _your-email_ > pubkey.txt

Then send the public key to me, and I can add you to the list of gpg users. Then you should continue:

git pull origin master
git-crypt unlock 

Using the search API

With this package in the search path, you can do a twitter search in Python, e.g., for "ucu"

import twitter
result = twitter.search("ucu")

import json
print json.dumps(result, indent=4)

The result is a Python structure (from the twitter API json result) containing tweets related to the search. In my experience, I get 15 tweets at the time, and the results are quite structured. There probably are ways to specify the query in a way that we ge more results, or filtered by language or time period etc. One of the things we could ask the students to do, is to collect particular items from the structure, and print them to a plain text table (csv), that can then be analysed in R.

Python twitter API

There are many. It is very well possible that this can be done in just a few lines using a standard package. However, I could not find anythong that could use the "application only authentication".

computing4liberalarts.py's People

Contributors

davidavdav avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.