Skip to main content

A package for analyzing twitter sentiments based on keyword and number of tweets

Project description

Package

Use this package to download and analyze twitter sentiments.

Usage

Before using the package you need to set user parameters obtained by creating a twitter
app first. The package will need to read the user data from your environment variables stored in the following dict format

user_params = {
    "consumerKey": os.environ.get("consumerKey"),
    "consumerSecret": os.environ.get("consumerSecret"),
    "accessToken": os.environ.get("accessToken"),
    "accessTokenSecret": os.environ.get("accessTokenSecret"),
}

Installation

Install the package as follows:
pip3 install twitcent

importing the module

In your script simply import the package as follows:

from twitcent.twitcent import sentiments_dict

Calling the analyzer

The sentiment analysis main function is 'sentiments_dict' which is called under the script as follows:
from twitcent.twitcent import sentiments_dict

Get the sentiments score by calling

Do this to get scored sentiments sentiments_dict('#keyword', '180').
Where #keyword is the main keyword hashtag to search, and '180' is a string referring to the number of tweets to pull.
Be careful not to hit the rate limits allowed by twitter. For this reffer to the
twitter API documentation

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

twitcent-0.0.2.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

twitcent-0.0.2-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file twitcent-0.0.2.tar.gz.

File metadata

  • Download URL: twitcent-0.0.2.tar.gz
  • Upload date:
  • Size: 8.1 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.10.2

File hashes

Hashes for twitcent-0.0.2.tar.gz
Algorithm Hash digest
SHA256 ad141a2a11afad6b3b4e8a04712586de58b26a1a4a3d83566558ec7975d7a57f
MD5 e4a234d46b0dd9fa6de0c634ebe6c5e0
BLAKE2b-256 338cc1ed01761dd4b07b3765982d9d76d84f4e25ecd91b796c0fd3c63fd9c95f

See more details on using hashes here.

File details

Details for the file twitcent-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: twitcent-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.9 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.10.2

File hashes

Hashes for twitcent-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e4851522fd887955b8e455cf31befc112677945cd2a59839c332bcf07f143649
MD5 9e5c32492d503547f7b1f96cfda04cc8
BLAKE2b-256 a67dc15f49566f285fde8d85992567ff8228f6a09be931deacde8d8e09413423

See more details on using hashes here.

Supported by

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