Skip to main content

PyPI version v2

Introduction

The OSoMeTweet project intends to provide a set of tools to help researchers work with Twitter's V2 API.

The Wiki includes a detailed documentation of how to use all methods. Also, we will use the wiki to store knowledge gathered by those who are building this package.

Installation

Install the PyPI version

pip install osometweet

Warning 1: The package is still in development, so not all endpoints are included and those which are included may not be 100% robust. Please see the list of issues for known problems.

Warning 2: We will try to keep the interface of the package consistent, but there may be drastic changes in the future.

Use the newest features & local development

The PyPI version may be behind the GitHub version. To ensure that you are using the latest features and functionalities, you can install the GitHub version locally.

To do so, clone this project, go to the source directory, and run pip install -e .

If you want to do this with git it should look something like the below, run from your command line:

git clone https://github.com/osome-iu/osometweet.git
cd ./osometweet
pip install -e .

Requirements

python>=3.5
requests>=2.24.0
requests_oauthlib>=1.3.0

Tests

Go to tests directory and run:

python tests.py

Note: you will need to have the following environment variables set in order for the tests to work properly.

  • TWITTER_API_KEY
  • TWITTER_API_KEY_SECRET
  • TWITTER_ACCESS_TOKEN
  • TWITTER_ACCESS_TOKEN_SECRET
  • TWITTER_BEARER_TOKEN

If you're not sure what these are, check out this page to learn how Twitter authentication works.

How to seek help and contribute

OSoMeTweet will be a community project and your help is welcome!

See How to contribute to the OsoMeTweet package for more details on how to contribute.

Quick start

Here is an example of how to use our package to pull user information:

import osometweet

# Initialize the OSoMeTweet object
bearer_token = "YOUR_TWITTER_BEARER_TOKEN"
oauth2 = osometweet.OAuth2(bearer_token=bearer_token)
ot = osometweet.OsomeTweet(oauth2)

# Set some test IDs (these are Twitter's own accounts)
ids2find = ["2244994945", "6253282"]

# Call the function with these ids as input
response = ot.user_lookup_ids(user_ids=ids2find)
print(response["data"])

which returns a list of dictionaries, where each dictionary contains the requested information for an individual user.

[
    {'id': '2244994945', 'name': 'Twitter Dev', 'username': 'TwitterDev'},
    {'id': '6253282', 'name': 'Twitter API', 'username': 'TwitterAPI'}
]

Learn how to use the package

Documentation on how to use all package methods are located in the Wiki.

Start here before using the example scripts!

Learn about Twitter V2

We have documented (and will continue to document) information about Twitter's V2 API that we deem is valuable. For example:

Example Scripts

We offer example scripts for working with different endpoints. We recommend that you read and understand the methods by reading the relevant package Wiki pages prior to using these scripts.

Metadata

Release files for osometweet 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for osometweet 0.4
File Size Uploaded
osometweet-0.4.tar.gz 20.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for osometweet 0.4
File Interpreter ABI Platform
osometweet-0.4-py3-none-any.whl Python 3 none any Details

Total release size: 42.1 kB

Release files / osometweet-0.4.tar.gz

Download URL osometweet-0.4.tar.gz
Size 20.6 kB
Tags Source
SHA-256 checksum
How to use checksums
76a981c5eb6bdf4300a42df470aa209afe013b8a6ea20d27d8c40c5574cac7e2
BLAKE2b-256 checksum
How to use checksums
37fc1f197dfefaa62c9388c5e8c7520012cddb9513d299afad1eb6a513b99568
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.5.0.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

Release files / osometweet-0.4-py3-none-any.whl

Download URL osometweet-0.4-py3-none-any.whl
Size 21.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
19ebc738a6ba2425d3091b09d9ae708e977814e15fafdf3090c2ec25901f107e
BLAKE2b-256 checksum
How to use checksums
ec7fe82e03b7750f303f0a0703e097480b7b1081e2cecc87de6b0256baedb826
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.5.0.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.4 This release

2 release files

0.3

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page