From 92db0cf87666229098809973554d20d35b2971a0 Mon Sep 17 00:00:00 2001 From: Harmon Date: Wed, 13 Jan 2021 21:40:55 -0600 Subject: [PATCH] Remove API.search_host, API.search_root, and APIMethod.search_api --- docs/api.rst | 14 +++++--------- tweepy/api.py | 14 ++++---------- tweepy/binder.py | 9 ++------- 3 files changed, 11 insertions(+), 26 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 73cc1f2..3517090 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -11,23 +11,19 @@ This page contains some basic documentation for the Tweepy module. :mod:`tweepy.api` --- Twitter API wrapper ========================================= -.. class:: API([auth_handler=None], [host='api.twitter.com'], \ - [search_host='search.twitter.com'], [cache=None], \ - [api_root='/1'], [search_root=''], [retry_count=0], \ - [retry_delay=0], [retry_errors=None], [timeout=60], \ - [parser=ModelParser], [compression=False], \ - [wait_on_rate_limit=False], [wait_on_rate_limit_notify=False], \ - [proxy=None]) +.. 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], \ + [compression=False], [wait_on_rate_limit=False], \ + [wait_on_rate_limit_notify=False], [proxy=None]) This class provides a wrapper for the API as provided by Twitter. The functions provided in this class are listed below. :param auth_handler: authentication handler to be used :param host: general API host - :param search_host: search API host :param cache: cache backend to use :param api_root: general API path root - :param search_root: search 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 7ea77fe..f8be6d3 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -16,11 +16,10 @@ class API: """Twitter API""" def __init__(self, auth_handler=None, - host='api.twitter.com', search_host='search.twitter.com', - upload_host='upload.twitter.com', cache=None, api_root='/1.1', - search_root='', upload_root='/1.1', retry_count=0, - retry_delay=0, retry_errors=None, timeout=60, parser=None, - compression=False, wait_on_rate_limit=False, + 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, compression=False, wait_on_rate_limit=False, wait_on_rate_limit_notify=False, proxy=''): """ API instance constructor @@ -28,13 +27,10 @@ class API: :param auth_handler: :param host: url of the server of the rest api, default: 'api.twitter.com' - :param search_host: url of the search server, - default: 'search.twitter.com' :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 search_root: suffix of the search version, default: '' :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 @@ -54,10 +50,8 @@ class API: """ self.auth = auth_handler self.host = host - self.search_host = search_host self.upload_host = upload_host self.api_root = api_root - self.search_root = search_root self.upload_root = upload_root self.cache = cache self.compression = compression diff --git a/tweepy/binder.py b/tweepy/binder.py index 893e176..f44ba92 100644 --- a/tweepy/binder.py +++ b/tweepy/binder.py @@ -29,7 +29,6 @@ def bind_api(**config): allowed_param = config.get('allowed_param', []) method = config.get('method', 'GET') require_auth = config.get('require_auth', False) - search_api = config.get('search_api', False) upload_api = config.get('upload_api', False) use_cache = config.get('use_cache', True) session = requests.Session() @@ -59,9 +58,7 @@ def bind_api(**config): self.build_parameters(args, kwargs) # Pick correct URL root to use - if self.search_api: - self.api_root = api.search_root - elif self.upload_api: + if self.upload_api: self.api_root = api.upload_root else: self.api_root = api.api_root @@ -69,9 +66,7 @@ def bind_api(**config): # Perform any path variable substitution self.build_path() - if self.search_api: - self.host = api.search_host - elif self.upload_api: + if self.upload_api: self.host = api.upload_host else: self.host = api.host -- 2.25.1