Skip to content

Commit

Permalink
feat: added some messages to debug the issue in github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
iamatulsingh committed Oct 28, 2024
1 parent e281e21 commit b5ffb34
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@ def test_single_data():
def test_v2():
p = Pinterest()
images_url = p.search(keyword, images_to_download)
print(p.errors)
assert len(images_url) == images_to_download
assert len(images_url) == images_to_download, p.errors
p.download(url_list=images_url, number_of_workers=number_of_workers, output_folder=output_folder)
7 changes: 7 additions & 0 deletions pinscrape/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,12 @@ def search(self, query: str, page_size=26) -> list:
logging.warning(f"Image search has failed!, {response.status_code}, {response.text}")
self.errors.append(f"Image search has failed!, {response.status_code}, {response.text}")
return []

msg = f"Response Headers: {response.headers}"
msg += f"Response Content-Type: {response.headers.get('Content-Type')}"
msg += f"Response: {response.text}"
msg += f"Status Code: {response.headers}"

try:
json_data = response.json()
results = json_data.get('resource_response', {}).get('data', {}).get('results', [])
Expand All @@ -214,6 +220,7 @@ def search(self, query: str, page_size=26) -> list:
return image_urls
except requests.exceptions.JSONDecodeError as jde:
self.errors.append(response.text)
self.errors.append(msg)
return []


Expand Down

0 comments on commit b5ffb34

Please sign in to comment.