seawolf2357 commited on
Commit
1be9f59
·
verified ·
1 Parent(s): 99127b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -17
app.py CHANGED
@@ -87,7 +87,7 @@ def search_serphouse(query, country, page=1, num_result=100):
87
  "data": {
88
  "q": query,
89
  "domain": "google.com",
90
- "loc": COUNTRY_CODE_MAPPING.get(country, "us"),
91
  "lang": "en",
92
  "device": "desktop",
93
  "serp_type": "news",
@@ -98,22 +98,6 @@ def search_serphouse(query, country, page=1, num_result=100):
98
  }
99
  }
100
 
101
- headers = {
102
- "accept": "application/json",
103
- "content-type": "application/json",
104
- "authorization": f"Bearer {API_KEY}"
105
- }
106
-
107
- try:
108
- response = requests.post(url, json=payload, headers=headers)
109
- response.raise_for_status()
110
- return response.json()
111
- except requests.RequestException as e:
112
- error_msg = f"Error: {str(e)}"
113
- if response.text:
114
- error_msg += f"\nResponse content: {response.text}"
115
- return {"error": error_msg}
116
-
117
  def format_results_from_raw(results):
118
  try:
119
  if isinstance(results, dict) and "error" in results:
 
87
  "data": {
88
  "q": query,
89
  "domain": "google.com",
90
+ "loc": COUNTRY_CODE_MAPPING.get(country, "us"), # 여기가 문제의 원인입니다
91
  "lang": "en",
92
  "device": "desktop",
93
  "serp_type": "news",
 
98
  }
99
  }
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  def format_results_from_raw(results):
102
  try:
103
  if isinstance(results, dict) and "error" in results: