From 9607a1741645ceb0fc58d8a1550034029c41dc53 Mon Sep 17 00:00:00 2001 From: Sourabh Gandhi <105213416+sgandhi1311@users.noreply.github.com> Date: Thu, 25 Jan 2024 18:05:57 +0530 Subject: [PATCH] Remove redundant code (#43) * Remove duplicate API calls * update requests from 2.23.0 to 2.31.0, tap version and changelog.md --- CHANGELOG.md | 4 ++++ setup.py | 4 ++-- tap_recharge/client.py | 7 ------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4448144..6ffba7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 2.0.3 + * Eliminate repetition of API calls + * [#43](https://github.com/singer-io/tap-recharge/pull/43) + ## 2.0.2 * Adds ChunkedEncodingError to backoff handling * Adds unittest diff --git a/setup.py b/setup.py index ab381bc..467221f 100644 --- a/setup.py +++ b/setup.py @@ -3,14 +3,14 @@ from setuptools import setup, find_packages setup(name='tap-recharge', - version='2.0.2', + version='2.0.3', description='Singer.io tap for extracting data from the ReCharge Payments API 2.0', author='jeff.huth@bytecode.io', classifiers=['Programming Language :: Python :: 3 :: Only'], py_modules=['tap_recharge'], install_requires=[ 'backoff==1.8.0', - 'requests==2.23.0', + 'requests==2.31.0', 'singer-python==5.10.0' ], entry_points=''' diff --git a/tap_recharge/client.py b/tap_recharge/client.py index 9c0b832..0d844d4 100644 --- a/tap_recharge/client.py +++ b/tap_recharge/client.py @@ -261,13 +261,6 @@ def request(self, method, path=None, url=None, **kwargs): # pylint: disable=too- if method == 'POST': kwargs['headers']['Content-Type'] = 'application/json' - with metrics.http_request_timer(endpoint) as timer: - response = self.__session.request(method, url, stream=True, timeout=self.request_timeout, **kwargs) - timer.tags[metrics.Tag.http_status_code] = response.status_code - - if response.status_code != 200: - raise_for_error(response) - # Intermittent JSONDecodeErrors when parsing JSON; Adding 2 attempts # FIRST ATTEMPT with metrics.http_request_timer(endpoint) as timer: