Skip to content

Commit cdbc264

Browse files
committed
Revert "ALL THE LOGS IN THE WORLD"
This reverts commit d965af0.
1 parent cdd6005 commit cdbc264

1 file changed

Lines changed: 10 additions & 51 deletions

File tree

webapp/store/snap_details_views.py

Lines changed: 10 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -17,50 +17,10 @@
1717
)
1818
from canonicalwebteam.exceptions import StoreApiError
1919
from canonicalwebteam.store_api.devicegw import DeviceGW
20-
device_gateway = DeviceGW("snap", helpers.api_session)
2120
from pybadges import badge
22-
import sys
23-
24-
25-
# --- Patch device_gateway.session.get to log full request/response ---
26-
original_get = device_gateway.session.get
27-
28-
def debug_get(url, *args, **kwargs):
29-
if "nushell" in url:
30-
print(f"\nDEBUG: GET request to URL: {url}")
31-
print(f"DEBUG: kwargs: {kwargs}")
32-
response = original_get(url, *args, **kwargs)
33-
if "nushell" in url:
34-
print(f"DEBUG: Response status: {response.status_code}")
35-
print(f"DEBUG: Response headers: {response.headers}")
36-
print(f"DEBUG: Response text (first 500 chars): {response.text[:500]}")
37-
sys.stdout.flush()
38-
return response
39-
40-
device_gateway.session.get = debug_get
41-
42-
# --- Patch get_snap_details to log input, output, and exceptions ---
43-
original_get_snap_details = device_gateway.get_snap_details
44-
45-
def debug_get_snap_details(snap_name, fields=None):
46-
if snap_name == "nushell":
47-
print(f"\nDEBUG: Calling get_snap_details with snap_name={snap_name}, fields={fields}")
48-
sys.stdout.flush()
49-
try:
50-
result = original_get_snap_details(snap_name, fields=fields)
51-
print(f"DEBUG: get_snap_details result:\n{result}")
52-
sys.stdout.flush()
53-
return result
54-
except Exception as e:
55-
print(f"DEBUG: Exception in get_snap_details: {e}")
56-
sys.stdout.flush()
57-
import traceback
58-
traceback.print_exc()
59-
raise
60-
61-
device_gateway.get_snap_details = debug_get_snap_details
62-
63-
import traceback
21+
22+
device_gateway = DeviceGW("snap", helpers.api_session)
23+
6424
FIELDS = [
6525
"title",
6626
"summary",
@@ -253,20 +213,19 @@ def snap_details(snap_name):
253213
status_code = 200
254214

255215
context = _get_context_snap_details(snap_name)
256-
print("----------------------------------------------------------------")
257-
print(f"DEBUGGING: {snap_name}",flush=True)
216+
print(f"DEBUGGING: {snap_name}")
258217
try:
259218
extra_details = device_gateway.get_snap_details(
260219
snap_name, fields=FIELDS_EXTRA_DETAILS
261220
)
262221
except Exception as e:
263-
print("IT FAILED",flush=True)
264222
print(e)
265-
traceback.print_exc()
266-
extra_details = None
267-
print("END_DEBUGGING",flush=True)
268-
269-
print("EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE")
223+
response = requests.get(
224+
f"https://api.snapcraft.io/api/v1/snaps/details/{snap_name}?fields=aliases",
225+
headers={"X-Ubuntu-Series": "16"})
226+
print(response.status_code)
227+
print(response.text)
228+
print("END_DEBUGGING")
270229

271230
if extra_details and extra_details["aliases"]:
272231
context["aliases"] = [

0 commit comments

Comments
 (0)