Skip to content

Commit

Permalink
Merge pull request #8 from hotgluexyz/fix/incomingError
Browse files Browse the repository at this point in the history
hide gql error print
  • Loading branch information
hsyyid authored Apr 6, 2022
2 parents e731f58 + d8b5775 commit f8270a3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name="tap-shopify",
version="1.4.7",
version="1.4.8",
description="Singer.io tap for extracting Shopify data",
author="Stitch",
url="http://github.com/singer-io/tap-shopify",
Expand Down
15 changes: 14 additions & 1 deletion tap_shopify/streams/incoming_items.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os
import sys
import shopify
import singer
import json
Expand All @@ -9,6 +11,16 @@
LOGGER = singer.get_logger()


class HiddenPrints:
def __enter__(self):
self._original_stdout = sys.stdout
sys.stdout = open(os.devnull, 'w')

def __exit__(self, exc_type, exc_val, exc_tb):
sys.stdout.close()
sys.stdout = self._original_stdout


class IncomingItems(Stream):
name = 'incoming_items'
replication_key = 'createdAt'
Expand All @@ -17,7 +29,8 @@ class IncomingItems(Stream):
@shopify_error_handling
def call_api_for_incoming_items(self, parent_object):
gql_client = shopify.GraphQL()
response = gql_client.execute(self.gql_query, dict(id=parent_object.admin_graphql_api_id))
with HiddenPrints():
response = gql_client.execute(self.gql_query, dict(id=parent_object.admin_graphql_api_id))
return json.loads(response)

def get_objects(self):
Expand Down

0 comments on commit f8270a3

Please sign in to comment.