Jam-Twitter-API


NameJam-Twitter-API JSON
Version 0.9 PyPI version JSON
download
home_pageNone
SummaryImplementation of X/Twitter v1, v2, and GraphQL APIs
upload_time2024-08-16 12:25:45
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Twitter API

## Installation

```bash 
pip install Jam-Twitter-API
```

## Usage

```python
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"})
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "Jam-Twitter-API",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Jaammerr <jaammer.dev@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/a9/9a/2080c15cd6f0391d770f452fa3e01ce1d611bb6934ba433774b169a8d43c/jam_twitter_api-0.9.tar.gz",
    "platform": null,
    "description": "# Twitter API\r\n\r\n## Installation\r\n\r\n```bash \r\npip install Jam-Twitter-API\r\n```\r\n\r\n## Usage\r\n\r\n```python\r\nfrom Jam_Twitter_API.account_sync import TwitterAccountSync\r\nfrom Jam_Twitter_API.errors import *\r\n\r\n\r\n# Create a TwitterAccount object\r\n# Set up a session using auth_token or cookies (it will auto create needed headers and cookies)\r\ntry:\r\n    account = TwitterAccountSync.run(\r\n        auth_token=\"0idfidfgdfgidfgijodfgjoidfgijo43\",\r\n        proxy=\"http://user:pass@host:port\",\r\n        setup_session=True,\r\n    )\r\n\r\n    account = TwitterAccountSync.run(\r\n        cookies={\"auth_token\": \"0idfidfgdfgidfgijodfgjoidfgijo43\", \"ct0\": \"0idfidfgdfgidfgijodfgjoidfgijo43\"},\r\n        proxy=\"http://user:pass@host:port\",\r\n        setup_session=True,\r\n    )\r\n\r\nexcept TwitterAccountSuspended as error:\r\n    # Raise when account is suspended\r\n    print(f\"Account is suspended: {error}\")\r\n\r\nexcept TwitterError as error:\r\n    # Raise when Twitter error occurs\r\n    print(f\"Twitter error occurred: {error.error_message} | {error.error_code}\")\r\n\r\nexcept IncorrectData as error:\r\n    # Raise when validation error occurs\r\n    print(f\"Incorrect data provided: {IncorrectData}\")\r\n\r\nexcept RateLimitError as error:\r\n    # Raise when rate limit exceeded\r\n    print(f\"Rate limit exceeded: {error}\")\r\n\r\n# A small part of the available methods:\r\nuser_tweets = account.user_last_tweets(\"elonmusk\")\r\nuser_followers = account.user_followers(\"elonmusk\")\r\nuser_following = account.user_followings(\"elonmusk\")\r\n\r\nuser_info = account.get_user_info(\"elonmusk\")\r\nuser_id = account.get_user_id(\"elonmusk\")\r\nfollow = account.follow(1000)\r\nunfollow = account.unfollow(1000)\r\n\r\nbind_account_to_site_v1 = account.bind_account_v1(\"url\")\r\nbind_account_to_site_v2 = account.bind_account_v2({\r\n    \"code_challenge\": \"test\",\r\n    \"code_challenge_method\": \"plain\",\r\n    \"client_id\": \"enpfUjhndkdrdHhld29adfg6eGM6MTpjaQ\",\r\n    \"redirect_uri\": \"https://www.test.io\",\r\n    \"response_type\": \"code\",\r\n    \"scope\": \"tweet.read users.read follows.read offline.access\",\r\n    \"state\": \"test\",\r\n})\r\n\r\ntweet_replies = account.tweet_replies(1000000000)\r\ntweet_retweets = account.tweet_retweeters(1000000000)\r\ntweet_likes = account.tweet_likes(1000000000)\r\n\r\ntweet = account.tweet(\"hello world\")\r\nuntweet = account.untweet(1000000000)\r\n\r\nquote = account.quote(\"hello world\", 10000)\r\nretweet = account.retweet(1000000000)\r\n\r\nreply = account.reply(\"hello world\", 1000000000)\r\nlike = account.like(1000000000)\r\nunlike = account.unlike(1000000000)\r\n\r\nupdate_image = account.update_profile_image(\"path/to/image.jpg\")\r\nupdate_banner = account.update_profile_banner(\"path/to/image.jpg\")\r\nupdate_profile_info = account.update_profile_info({\"location\": \"San Francisco\"})\r\n```\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Implementation of X/Twitter v1, v2, and GraphQL APIs",
    "version": "0.9",
    "project_urls": {
        "Homepage": "https://github.com/Jaammerr/Twitter-API",
        "Issues": "https://github.com/Jaammerr/Twitter-API/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9e2dc3ed2bff086ce4b4b55331374cc60f57248a78314a65de0fb3ffb3798611",
                "md5": "987eaa6cee09432932a222ef51e8927e",
                "sha256": "7100845e410bb18e1d0ac122e97c6d12bbab911a7a18ffba4a77ea63d94b6531"
            },
            "downloads": -1,
            "filename": "Jam_Twitter_API-0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "987eaa6cee09432932a222ef51e8927e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 41275,
            "upload_time": "2024-08-16T12:25:44",
            "upload_time_iso_8601": "2024-08-16T12:25:44.599678Z",
            "url": "https://files.pythonhosted.org/packages/9e/2d/c3ed2bff086ce4b4b55331374cc60f57248a78314a65de0fb3ffb3798611/Jam_Twitter_API-0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a99a2080c15cd6f0391d770f452fa3e01ce1d611bb6934ba433774b169a8d43c",
                "md5": "5564f72987bba8e7e865e10aa9f0c441",
                "sha256": "9fc2a9d59bbaa730433741519211ff897dcf7bfa86ee574362ec396e4211d9a8"
            },
            "downloads": -1,
            "filename": "jam_twitter_api-0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "5564f72987bba8e7e865e10aa9f0c441",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 39953,
            "upload_time": "2024-08-16T12:25:45",
            "upload_time_iso_8601": "2024-08-16T12:25:45.830199Z",
            "url": "https://files.pythonhosted.org/packages/a9/9a/2080c15cd6f0391d770f452fa3e01ce1d611bb6934ba433774b169a8d43c/jam_twitter_api-0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-16 12:25:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Jaammerr",
    "github_project": "Twitter-API",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "jam-twitter-api"
}
        
Elapsed time: 0.35202s