Skip to main content

Twitter API

Installation

pip install Jam-Twitter-API

Usage

from Jam_Twitter_API.account_sync import TwitterAccountSync
from Jam_Twitter_API.errors import *


# Create a TwitterAccount object
# Set up a session using auth_token or cookies (it will auto create needed headers and cookies)
try:
    account = TwitterAccountSync.run(
        auth_token="0idfidfgdfgidfgijodfgjoidfgijo43",
        proxy="http://user:pass@host:port",
        setup_session=True,
    )

    account = TwitterAccountSync.run(
        cookies={"auth_token": "0idfidfgdfgidfgijodfgjoidfgijo43", "ct0": "0idfidfgdfgidfgijodfgjoidfgijo43"},
        proxy="http://user:pass@host:port",
        setup_session=True,
    )

except TwitterAccountSuspended as error:
    # Raise when account is suspended
    print(f"Account is suspended: {error}")

except TwitterError as error:
    # Raise when Twitter error occurs
    print(f"Twitter error occurred: {error.error_message} | {error.error_code}")

except IncorrectData as error:
    # Raise when validation error occurs
    print(f"Incorrect data provided: {IncorrectData}")

except RateLimitError as error:
    # Raise when rate limit exceeded
    print(f"Rate limit exceeded: {error}")

# A small part of the available methods:
user_tweets = account.user_last_tweets("elonmusk")
user_followers = account.user_followers("elonmusk")
user_following = account.user_followings("elonmusk")

user_info = account.get_user_info("elonmusk")
user_id = account.get_user_id("elonmusk")
follow = account.follow(1000)
unfollow = account.unfollow(1000)

bind_account_to_site_v1 = account.bind_account_v1("url")
bind_account_to_site_v2 = account.bind_account_v2({
    "code_challenge": "test",
    "code_challenge_method": "plain",
    "client_id": "enpfUjhndkdrdHhld29adfg6eGM6MTpjaQ",
    "redirect_uri": "https://www.test.io",
    "response_type": "code",
    "scope": "tweet.read users.read follows.read offline.access",
    "state": "test",
})

tweet_replies = account.tweet_replies(1000000000)
tweet_retweets = account.tweet_retweeters(1000000000)
tweet_likes = account.tweet_likes(1000000000)

tweet = account.tweet("hello world")
untweet = account.untweet(1000000000)

quote = account.quote("hello world", 10000)
retweet = account.retweet(1000000000)

reply = account.reply("hello world", 1000000000)
like = account.like(1000000000)
unlike = account.unlike(1000000000)

update_image = account.update_profile_image("path/to/image.jpg")
update_banner = account.update_profile_banner("path/to/image.jpg")
update_profile_info = account.update_profile_info({"location": "San Francisco"})

Metadata

Release files for Jam-Twitter-API 1.1

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

Source distribution (sdist)

Source distribution for Jam-Twitter-API 1.1
File Size Uploaded
jam_twitter_api-1.1.tar.gz 40.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Jam-Twitter-API 1.1
File Interpreter ABI Platform
Jam_Twitter_API-1.1-py3-none-any.whl Python 3 none any Details

Total release size: 83.3 kB

Release files / jam_twitter_api-1.1.tar.gz

Download URL jam_twitter_api-1.1.tar.gz
Size 40.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e845e50687a4cbec0f8efa830b8cba76326c2c46a623c20088896dc92339eb4f
BLAKE2b-256 checksum
How to use checksums
8131aa89e6532b710de86474ecf919b717847f7e33cf4b30c19bdfe123545fee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.4

Release files / Jam_Twitter_API-1.1-py3-none-any.whl

Download URL Jam_Twitter_API-1.1-py3-none-any.whl
Size 42.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d8212f610672f8a7af3cb6ffa55fb410e61c69cca7fb2e898acbce57861faf94
BLAKE2b-256 checksum
How to use checksums
05d213609f0f6df26d7185a2cd76e7e3de0142a8e9438ca380f4a5a832d68643
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.4

Release history Release notifications | RSS feed

This release

1.1 This release

2 release files

1.0

2 release files

0.9

2 release files

0.8

2 release files

0.7

2 release files

0.6

2 release files

0.5

2 release files

0.4

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