Skip to main content

Collect and visualize twitter poll data.

Project description

tweepypoll

Overview

tweepypoll is a Python package that allows users to extract and visualize poll data (poll questions, poll options, poll responses, etc.) from Twitter. Our goal is to make tweepypoll helpful and user-friendly; any Python beginner can effectively gain access to the data and make their own data-driven decisions. In particular, it could be a useful package for people doing social media journalism, or those studying social media interactions.

NOTE: This package assumes that the user has signed up for Twitter API Developer account, acquired the bearer token and set the environmental variable "BEARER_TOKEN". To acquire the bearer token, please follow the instructions here.

Functions

  • get_poll_by_id:

    • This function extracts poll data from Twitter given the poll ID.
  • get_polls_from_user:

    • This function retrieves a list of poll IDs from a Twitter user. These ids can be fed into the get_poll_by_id and visualize_poll functions.
  • visualize_poll:

    • This function takes in the output of get_poll_by_id function and visualizes the poll information.

Related Packages

There are a few existing Python packages that have similar functionality for tweets from Twitter. For example, pytweet is a package that helps extract tweets, visualize user habit on tweet posting, and apply sentiment analysis to the data. However, there are no available packages that work specifically on polls from Twitter.

Installation

$ pip install tweepypoll

Dependencies

  • python = "^3.9"
  • altair = "^4.2.0"
  • pandas = "^1.3.5"
  • tweepy = "^4.4.0"
  • python-dotenv = "^0.19.2"

Usage

from tweepypoll.tweepypoll import get_poll_by_id
get_poll_by_id(tweet_id)

tweet_id is numeric, such as 1481040318325739523

from tweepypoll.tweepypoll import get_polls_from_user
get_polls_from_user('user_id')

where user_is is a string username, such as 'tacobell'

from tweepypoll.tweepypoll import visualize_poll
visualize_poll(poll_obj, show_user=False, show_duration=False, show_date=False)

poll_obj is a dict outputted by get_poll_by_id(), show_user, show_duration, show_date are optional booleans to display username, poll duration and poll end date, respectively

Contributors

  • Wenxin Xiang
  • Rada Rudyak
  • Linh Giang Nguyen

Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

tweepypoll was created by Wenxin Xiang, Rada Rudyak, Linh Giang Nguyen. It is licensed under the terms of the MIT license.

Credits

tweepypoll was created with cookiecutter and the py-pkgs-cookiecutter template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tweepypoll-0.2.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

tweepypoll-0.2.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file tweepypoll-0.2.0.tar.gz.

File metadata

  • Download URL: tweepypoll-0.2.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10

File hashes

Hashes for tweepypoll-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0beea5b9689a2a40b13fa365c3916bc46f610901540e9cf0d7a3020fca68f913
MD5 56c757bcfe979a90198c956bcaef7395
BLAKE2b-256 ba49ee048aa76b445f6abf006de1ef6fcc72aa8677da944e07ff805c85064739

See more details on using hashes here.

File details

Details for the file tweepypoll-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: tweepypoll-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10

File hashes

Hashes for tweepypoll-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c9a72e0a2264b5fef47c931f78b13a226e7740983f3c8b835078e940f4635b81
MD5 a81f6350ff72633f99fe00fbc861f930
BLAKE2b-256 d81fbd957ef46b1abee54cf3bf4b2fb7df36ef88f7fc8452f48268355b4a3eb9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page