From e7579194edd367a5fea6e50dc1cd0d82f3ae643d Mon Sep 17 00:00:00 2001 From: Harmon Date: Wed, 3 Feb 2021 02:19:18 -0600 Subject: [PATCH] Remove API.api_root and API.upload_root --- docs/api.rst | 5 ++--- tweepy/api.py | 9 ++------- tweepy/binder.py | 3 +-- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 68bc075..e74445f 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -12,8 +12,8 @@ This page contains some basic documentation for the Tweepy module. ========================================= .. class:: API([auth_handler=None], [host='api.twitter.com'], [cache=None], \ - [api_root='/1'], , [retry_count=0], [retry_delay=0], \ - [retry_errors=None], [timeout=60], [parser=ModelParser], \ + [retry_count=0], [retry_delay=0], [retry_errors=None], \ + [timeout=60], [parser=ModelParser], \ [wait_on_rate_limit=False], [proxy=None]) This class provides a wrapper for the API as provided by Twitter. @@ -22,7 +22,6 @@ This page contains some basic documentation for the Tweepy module. :param auth_handler: authentication handler to be used :param host: general API host :param cache: cache backend to use - :param api_root: general API path root :param retry_count: default number of retries to attempt when error occurs :param retry_delay: number of seconds to wait between retries :param retry_errors: which HTTP status codes to retry diff --git a/tweepy/api.py b/tweepy/api.py index e93c256..874efcd 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -17,9 +17,8 @@ class API: def __init__(self, auth_handler=None, host='api.twitter.com', upload_host='upload.twitter.com', - cache=None, api_root='/1.1', upload_root='/1.1', - retry_count=0, retry_delay=0, retry_errors=None, timeout=60, - parser=None, wait_on_rate_limit=False, proxy=''): + cache=None, retry_count=0, retry_delay=0, retry_errors=None, + timeout=60, parser=None, wait_on_rate_limit=False, proxy=''): """ API instance constructor @@ -29,8 +28,6 @@ class API: :param upload_host: url of the upload server, default: 'upload.twitter.com' :param cache: Cache to query if a GET method is used, default: None - :param api_root: suffix of the api version, default: '/1.1' - :param upload_root: suffix of the upload version, default: '/1.1' :param retry_count: number of allowed retries, default: 0 :param retry_delay: delay in second between retries, default: 0 :param retry_errors: default: None @@ -47,8 +44,6 @@ class API: self.auth = auth_handler self.host = host self.upload_host = upload_host - self.api_root = api_root - self.upload_root = upload_root self.cache = cache self.retry_count = retry_count self.retry_delay = retry_delay diff --git a/tweepy/binder.py b/tweepy/binder.py index dd267a4..15347d5 100644 --- a/tweepy/binder.py +++ b/tweepy/binder.py @@ -27,11 +27,10 @@ def bind_api(api, method, endpoint, *args, allowed_param=[], params=None, api.cached_result = False # Build the request URL + path = f'/1.1/{endpoint}.json' if upload_api: - path = f'{api.upload_root}/{endpoint}.json' url = 'https://' + api.upload_host + path else: - path = f'{api.api_root}/{endpoint}.json' url = 'https://' + api.host + path if params is None: -- 2.25.1