Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit db118d3

Browse files
committed
add preconfigured wrapper class Twitter2
1 parent e7925a9 commit db118d3

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

twitter/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from textwrap import dedent
1010

11-
from .api import Twitter, TwitterError, TwitterHTTPError, TwitterResponse
11+
from .api import Twitter, Twitter2, TwitterError, TwitterHTTPError, TwitterResponse
1212
from .auth import NoAuth, UserPassAuth
1313
from .oauth import (
1414
OAuth, read_token_file, write_token_file,
@@ -73,6 +73,7 @@
7373
"read_bearer_token_file",
7474
"read_token_file",
7575
"Twitter",
76+
"Twitter2",
7677
"TwitterError",
7778
"TwitterHTTPError",
7879
"TwitterResponse",

twitter/api.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,4 +618,20 @@ def __init__(
618618
verify_context=verify_context)
619619

620620

621-
__all__ = ["Twitter", "TwitterError", "TwitterHTTPError", "TwitterResponse"]
621+
class Twitter2(Twitter):
622+
623+
def __init__(
624+
self, secure=True, auth=None, retry=False, verify_context=True):
625+
626+
Twitter.__init__(
627+
self,
628+
domain="api.twitter.com",
629+
api_version="2",
630+
format="",
631+
auth=auth,
632+
retry=retry,
633+
secure=secure,
634+
verify_context=verify_context)
635+
636+
637+
__all__ = ["Twitter", "Twitter2", "TwitterError", "TwitterHTTPError", "TwitterResponse"]

0 commit comments

Comments
 (0)