Ronio Jerico Roque commited on
Commit
1cb128c
·
1 Parent(s): ecef08e

Refactor Marketplace response handling; simplify text extraction and update output method in output.py

Browse files
classes/response_marketplace.py CHANGED
@@ -39,13 +39,13 @@ class Marketplace:
39
  response.raise_for_status()
40
  output = response.json()
41
  #st.write(output)
42
- text_amazon = output["outputs"][0]["outputs"][0]["results"]["text"]["data"]["text"]["amazon"]
43
- text_ebay = output["outputs"][0]["outputs"][0]["results"]["text"]["data"]["text"]["ebay"]
44
  text_amazon = json.loads(text_amazon)
45
- text_ebay = json.loads(text_ebay)
46
- text = text_amazon + text_ebay
47
- #st.write(text)
48
- return text
49
 
50
  def fetch_backlinks(self, data_field):
51
  mongodb_uri = os.getenv("MONGODB_URI")
 
39
  response.raise_for_status()
40
  output = response.json()
41
  #st.write(output)
42
+ text_amazon = output["outputs"][0]["outputs"][0]["results"]["text"]["data"]["text"]
43
+ #text_ebay = output["outputs"][0]["outputs"][0]["results"]["text"]["data"]["text"]["ebay"]
44
  text_amazon = json.loads(text_amazon)
45
+ #text_ebay = json.loads(text_ebay)
46
+ #text = text_amazon + text_ebay
47
+ #st.write(text_amazon)
48
+ return text_amazon
49
 
50
  def fetch_backlinks(self, data_field):
51
  mongodb_uri = os.getenv("MONGODB_URI")
pages/output.py CHANGED
@@ -251,9 +251,9 @@ Regardless, it is still a great channel worth investing to improve a business’
251
  st.markdown("<a href='#top'>Go to top</a>", unsafe_allow_html=True)
252
  st.markdown("---")
253
 
254
- if (get_marketplace_response("Marketplace Analyst")):
255
  st.markdown("### MARKET PLACE")
256
- marketpalce_data = get_marketplace_response("Marketplace Analyst")
257
  write_table(marketpalce_data)
258
  st.markdown("<a href='#top'>Go to top</a>", unsafe_allow_html=True)
259
  st.markdown("---")
 
251
  st.markdown("<a href='#top'>Go to top</a>", unsafe_allow_html=True)
252
  st.markdown("---")
253
 
254
+ if (get_analyst_response("Marketplace Analyst")):
255
  st.markdown("### MARKET PLACE")
256
+ marketpalce_data = get_analyst_response("Marketplace Analyst")
257
  write_table(marketpalce_data)
258
  st.markdown("<a href='#top'>Go to top</a>", unsafe_allow_html=True)
259
  st.markdown("---")