API = https://fulfillment.paytm.com/v2/issues?is_cst=1&is_bank=0&parent_issue_id=24000001
While I place a GET request I get the below HTML format data :- Can anyone please help me understand, how do I grab specific headers like - "issue_text" from the below data with its values
'{"reasonObjs":[{"id":24000012,"parent_issue_id":24000001,"replacement_allowed":0,"cancellation_allowed":0,"raise_ticket_allowed":1,"return_allowed":0,"is_active":1,"is_admin_user":0,"is_merchant_user":0,"is_customer_user":1,"is_paytm_owner":1,"is_fc_owner":0,"is_merchant_owner":0,"message":"","comments":"","issue_text":"My order is pending for a long time","out_of_stock":0,"is_replaced_order":0,"icon":"","level":3,"order_flag":1,"faq_link":null,"is_call_allowed":0,"is_email_allowed":1,"priority":0,"is_bank":0,"is_version":0,"is_seller_user":0,"vertical_id":131,"category_id":null,"order_state":22,"meta_data":{"our_suggestion":{"id":399855,"issue_id":24000012,"key":"our_suggestion","value":"This may happen because we are awaiting confirmation on payment from your bank. No worries! We are checking with your bank on regular intervals to know the status of your transaction. Please wait for sometime before placing another order as orders once initiated cannot be cancelled.","file":""}},"display_text":"My order is pending for a long time"},{"id":24000012,"parent_issue_id":24000001,"replacement_allowed":0,"cancellation_allowed":0,"raise_ticket_allowed":1,"return_allowed":0,"is_active":1,"is_admin_user":0,"is_merchant_user":0,"is_customer_user":1,"is_paytm_owner":1,"is_fc_owner":0,"is_merchant_owner":0,"message":"","comments":"","issue_text":"My order is pending for a long time","out_of_stock":0,"is_replaced_order":0,"icon":"","level":3,"order_flag":1,"faq_link":null,"is_call_allowed":0,"is_email_allowed":1,"priority":0,"is_bank":0,"is_version":0,"is_seller_user":0,"vertical_id":131,"category_id":null,"order_state":22,"meta_data":{"our_suggestion":{"id":399855,"issue_id":24000012,"key":"our_suggestion","value":"This may happen because we are awaiting confirmation on payment from your bank. No worries! We are checking with your bank on regular intervals to know the status of your transaction. Please wait for sometime before placing another order as orders once initiated cannot be cancelled.","file":""}},"display_text":"My order is pending for a long time"},{"id":24000012,"parent_issue_id":24000001,"replacement_allowed":0,"cancellation_allowed":0,"raise_ticket_allowed":1,"return_allowed":0,"is_active":1,"is_admin_user":0,"is_merchant_user":0,"is_customer_user":1,"is_paytm_owner":1,"is_fc_owner":0,"is_merchant_owner":0,"message":"","comments":"","issue_text":"My order is pending for a long time","out_of_stock":0,"is_replaced_order":0,"icon":"","level":3,"order_flag":1,"faq_link":null,"is_call_allowed":0,"is_email_allowed":1,"priority":0,"is_bank":0,"is_version":0,"is_seller_user":0,"vertical_id":131,"category_id":null,"order_state":22,"meta_data":{"our_suggestion":{"id":399855,"issue_id":24000012,"key":"our_suggestion","value":"This may happen because we are awaiting confirmation on payment from your bank. No worries! We are checking with your bank on regular intervals to know the status of your transaction. Please wait for sometime before placing another order as orders once initiated cannot be cancelled.","file":""}},"display_text":"My order is pending for a long time"},{"id":24000012,"parent_issue_id":24000001,"replacement_allowed":0,"cancellation_allowed":0,"raise_ticket_allowed":1,"return_allowed":0,"is_active":1,"is_admin_user":0,"is_merchant_user":0,"is_customer_user":1,"is_paytm_owner":1,"is_fc_owner":0,"is_merchant_owner":0,"message":"","comments":"","issue_text":"My order is pending for a long time","out_of_stock":0,"is_replaced_order":0,"icon":"","level":3,"order_flag":1,"faq_link":null,"is_call_allowed":0,"is_email_allowed":1,"priority":0,"is_bank":0,"is_version":0,"is_seller_user":0,"vertical_id":131,"category_id":null,"order_state":22,"meta_data":{"our_suggestion":{"id":399855,"issue_id":24000012,"key":"our_suggestion","value":"This may happen because we are awaiting confirmation on payment from your bank. No worries! We are checking with your bank on regular intervals to know the status of your transaction. Please wait for sometime before placing another order as orders once initiated cannot be cancelled.","file":""}},"display_text":"My order is pending for a long time"},{"id":24000012,"parent_issue_id":24000001,"replacement_allowed":0,"cancellation_allowed":0,"raise_ticket_allowed":1,"return_allowed":0,"is_active":1,"is_admin_user":0,"is_merchant_user":0,"is_customer_user":1,"is_paytm_owner":1,"is_fc_owner":0,"is_merchant_owner":0,"message":"","comments":"","issue_text":"My order is pending for a long time","out_of_stock":0,"is_replaced_order":0,"icon":"","level":3,"order_flag":1,"faq_link":null,"is_call_allowed":0,"is_email_allowed":1,"priority":0,"is_bank":0,"is_version":0,"is_seller_user":0,"vertical_id":131,"category_id":null,"order_state":22,"meta_data":{"our_suggestion":{"id":399855,"issue_id":24000012,"key":"our_suggestion","value":"This may happen because we are awaiting confirmation on payment from your bank. No worries! We are checking with your bank on regular intervals to know the status of your transaction. Please wait for sometime before placing another order as orders once initiated cannot be cancelled.","file":""}},"display_text":"My order is pending for a long time"},{"id":24000013,"parent_issue_id":24000001,"replacement_allowed":0,"cancellation_allowed":0,"raise_ticket_allowed":1,"return_allowed":0,"is_active":1,"is_admin_user":0,"is_merchant_user":0,"is_customer_user":1,"is_paytm_owner":1,"is_fc_owner":0,"is_merchant_owner":0,"message":"","comments":"","issue_text":"I am unable to cancel my order","out_of_stock":0,"is_replaced_order":0,"icon":"","level":3,"order_flag":1,"faq_link":null,"is_call_allowed":0,"is_email_allowed":0,"priority":null,"is_bank":0,"is_version":0,"is_seller_user":0,"vertical_id":131,"category_id":null,"order_state":7,"meta_data":{"our_suggestion":{"id":399856,"issue_id":24000013,"key":"our_suggestion","value":"The orders for Paytm First membership, once initiated, cannot be cancelled. However, the Paytm First members will enjoy a wide range of exclusive benefits from leading partner brands for the entire year. This includes Zomato Gold membership, Gaana annual membership, Annual Sony Liv subscription, OYO Wizard, Blue membership, GOQii Plus annual membership, ViU Premium, The Man Company (offers worth Rs 2400 on products), Ombre Lane (offers worth Rs 6000 on women formals), Eros Now annual membership, Uber (benefits up to Rs 6000) and many more exciting partner offers worth more than Rs. 12,000.","file":""},"deeplink":{"id":400319,"issue_id":24000013,"key":"deeplink","value":"Click here to view all the benefits of Paytm First membership#https://paytm.com/offer/weex/paytm_first-test.php","file":""}},"display_text":"I am unable to cancel my order"},{"id":24000013,"parent_issue_id":24000001,"replacement_allowed":0,"cancellation_allowed":0,"raise_ticket_allowed":1,"return_allowed":0,"is_active":1,"is_admin_user":0,"is_merchant_user":0,"is_customer_user":1,"is_paytm_owner":1,"is_fc_owner":0,"is_merchant_owner":0,"message":"","comments":"","issue_text":"I am unable to cancel my order","out_of_stock":0,"is_replaced_order":0,"icon":"","level":3,"order_flag":1,"faq_link":null,"is_call_allowed":0,"is_email_allowed":0,"priority":null,"is_bank":0,"is_version":0,"is_seller_user":0,"vertical_id":131,"category_id":null,"order_state":7,"meta_data":{"our_suggestion":{"id":399856,"issue_id":24000013,"key":"our_suggestion","value":"The orders for Paytm First membership, once initiated, cannot be cancelled. However, the Paytm First members will enjoy a wide range of exclusive benefits from leading partner brands for the entire year. This includes Zomato Gold membership, Gaana annual membership, Annual Sony Liv subscription, OYO Wizard, Blue membership, GOQii Plus annual membership, ViU Premium, The Man Company (offers worth Rs 2400 on products), Ombre Lane (offers worth Rs 6000 on women formals), Eros Now annual membership, Uber (benefits up to Rs 6000) and many more exciting partner offers worth more than Rs. 12,000.","file":""},"deeplink":{"id":400319,"issue_id":24000013,"key":"deeplink","value":"Click here to view all the benefits of Paytm First membership#https://paytm.com/offer/weex/paytm_first-test.php","file":""}},"display_text":"I am unable to cancel my order"},{"id":24000013,"parent_issue_id":24000001,"replacement_allowed":0,"cancellation_allowed":0,"raise_ticket_allowed":1,"return_allowed":0,"is_active":1,"is_admin_user":0,"is_merchant_user":0,"is_customer_user":1,"is_paytm_owner":1,"is_fc_owner":0,"is_merchant_owner":0,"message":"","comments":"","issue_text":"I am unable to cancel my order","out_of_stock":0,"is_replaced_order":0,"icon":"","level":3,"order_flag":1,"faq_link":null,"is_call_allowed":0,"is_email_allowed":0,"priority":null,"is_bank":0,"is_version":0,"is_seller_user":0,"vertical_id":131,"category_id":null,"order_state":7,"meta_data":{"our_suggestion":{"id":399856,"issue_id":24000013,"key":"our_suggestion","value":"The orders for Paytm First membership, once initiated, cannot be cancelled. However, the Paytm First members will enjoy a wide range of exclusive benefits from leading partner brands for the entire year. This includes Zomato Gold membership, Gaana annual membership, Annual Sony Liv subscription, OYO Wizard, Blue membership, GOQii Plus annual membership, ViU Premium, The Man Company (offers worth Rs 2400 on products), Ombre Lane (offers worth Rs 6000 on women formals), Eros Now annual membership, Uber (benefits up to Rs 6000) and many more exciting partner offers worth more than Rs. 12,000.","file":""},"deeplink":{"id":400319,"issue_id":24000013,"key":"deeplink","value":"Click here to view all the benefits of Paytm First membership#https://paytm.com/offer/weex/paytm_first-test.php","file":""}},"display_text":"I am unable to cancel my order"},{"id":24000013,"parent_issue_id":24000001,"replacement_allowed":0,"cancellation_allowed":0,"raise_ticket_allowed":1,"return_allowed":0,"is_active":1,"is_admin_user":0,"is_merchant_user":0,"is_customer_user":1,"is_paytm_owner":1,"is_fc_owner":0,"is_merchant_owner":0,"message":"","comments":"","issue_text":"I am unable to cancel my order","out_of_stock":0,"is_replaced_order":0,"icon":"","level":3,"order_flag":1,"faq_link":null,"is_call_allowed":0,"is_email_allowed":0,"priority":null,"is_bank":0,"is_version":0,"is_seller_user":0,"vertical_id":131,"category_id":null,"order_state":7,"meta_data":{"our_suggestion":{"id":399856,"issue_id":24000013,"key":"our_suggestion","value":"The orders for Paytm First membership, once initiated, cannot be cancelled. However, the Paytm First members will enjoy a wide range of exclusive benefits from leading partner brands for the entire year. This includes Zomato Gold membership, Gaana annual membership, Annual Sony Liv subscription, OYO Wizard, Blue membership, GOQii Plus annual membership, ViU Premium, The Man Company (offers worth Rs 2400 on products), Ombre Lane (offers worth Rs 6000 on women formals), Eros Now annual membership, Uber (benefits up to Rs 6000) and many more exciting partner offers worth more than Rs. 12,000.","file":""},"deeplink":{"id":400319,"issue_id":24000013,"key":"deeplink","value":"Click here to view all the benefits of Paytm First membership#https://paytm.com/offer/weex/paytm_first-test.php","file":""}},"display_text":"I am unable to cancel my order"},{"id":24000013,"parent_issue_id":24000001,"replacement_allowed":0,"cancellation_allowed":0,"raise_ticket_allowed":1,"return_allowed":0,"is_active":1,"is_admin_user":0,"is_merchant_user":0,"is_customer_user":1,"is_paytm_owner":1,"is_fc_owner":0,"is_merchant_owner":0,"message":"","comments":"","issue_text":"I am unable to cancel my order","out_of_stock":0,"is_replaced_order":0,"icon":"","level":3,"order_flag":1,"faq_link":null,"is_call_allowed":0,"is_email_allowed":0,"priority":null,"is_bank":0,"is_version":0,"is_seller_user":0,"vertical_id":131,"category_id":null,"order_state":7,"meta_data":{"our_suggestion":{"id":399856,"issue_id":24000013,"key":"our_suggestion","value":"The orders for Paytm First membership, once initiated, cannot be cancelled. However, the Paytm First members will enjoy a wide range of exclusive benefits from leading partner brands for the entire year. This includes Zomato Gold membership, Gaana annual membership, Annual Sony Liv subscription, OYO Wizard, Blue membership, GOQii Plus annual membership, ViU Premium, The Man Company (offers worth Rs 2400 on products), Ombre Lane (offers worth Rs 6000 on women formals), Eros Now annual membership, Uber (benefits up to Rs 6000) and many more exciting partner offers worth more than Rs. 12,000.","file":""},"deeplink":{"id":400319,"issue_id":24000013,"key":"deeplink","value":"Click here to view all the benefits of Paytm First membership#https://paytm.com/offer/weex/paytm_first-test.php","file":""}},"display_text":"I am unable to cancel my order"},{"id":24000013,"parent_issue_id":24000001,"replacement_allowed":0,"cancellation_allowed":0,"raise_ticket_allowed":1,"return_allowed":0,"is_active":1,"is_admin_user":0,"is_merchant_user":0,"is_customer_user":1,"is_paytm_owner":1,"is_fc_owner":0,"is_merchant_owner":0,"message":"","comments":"","issue_text":"I am unable to cancel my order","out_of_stock":0,"is_replaced_order":0,"icon":"","level":3,"order_flag":1,"faq_link":null,"is_call_allowed":0,"is_email_allowed":0,"priority":null,"is_bank":0,"is_version":0,"is_seller_user":0,"vertical_id":131,"category_id":null,"order_state":7,"meta_data":{"our_suggestion":{"id":399856,"issue_id":24000013,"key":"our_suggestion","value":"The orders for Paytm First membership, once initiated, cannot be cancelled. However, the Paytm First members will enjoy a wide range of exclusive benefits from leading partner brands for the entire year. This includes Zomato Gold membership, Gaana annual membership, Annual Sony Liv subscription, OYO Wizard, Blue membership, GOQii Plus annual membership, ViU Premium, The Man Company (offers worth Rs 2400 on products), Ombre Lane (offers worth Rs 6000 on women formals), Eros Now annual membership, Uber (benefits up to Rs 6000) and many more exciting partner offers worth more than Rs. 12,000.","file":""},"deeplink":{"id":400319,"issue_id":24000013,"key":"deeplink","value":"Click here to view all the benefits of Paytm First membership#https://paytm.com/offer/weex/paytm_first-test.php","file":""}},"display_text":"I am unable to cancel my order"},{"id":24000035,"parent_issue_id":24000001,"replacement_allowed":0,"cancellation_allowed":0,"raise_ticket_allowed":1,"return_allowed":0,"is_active":1,"is_admin_user":0,"is_merchant_user":0,"is_customer_user":1,"is_paytm_owner":1,"is_fc_owner":0,"is_merchant_owner":0,"message":"","comments":"","issue_text":"I cannot find invoice for purchase of membership","out_of_stock":0,"is_replaced_order":0,"icon":"","level":3,"order_flag":1,"faq_link":null,"is_call_allowed":0,"is_email_allowed":1,"priority":null,"is_bank":0,"is_version":0,"is_seller_user":0,"vertical_id":null,"category_id":null,"order_state":null,"meta_data":{"our_suggestion":{"id":399857,"issue_id":24000035,"key":"our_suggestion","value":"To download the invoice, please go the My Orders section and choose the order. Click on Invoice icon to download","file":""}},"display_text":"I cannot find invoice for purchase of membership"},{"id":24000036,"parent_issue_id":24000001,"replacement_allowed":0,"cancellation_allowed":0,"raise_ticket_allowed":1,"return_allowed":0,"is_active":1,"is_admin_user":0,"is_merchant_user":0,"is_customer_user":1,"is_paytm_owner":1,"is_fc_owner":0,"is_merchant_owner":0,"message":"","comments":"","issue_text":"How do I check the validity of my Paytm First Membership?","out_of_stock":0,"is_replaced_order":0,"icon":"","level":3,"order_flag":1,"faq_link":null,"is_call_allowed":0,"is_email_allowed":1,"priority":null,"is_bank":0,"is_version":0,"is_seller_user":0,"vertical_id":null,"category_id":null,"order_state":null,"meta_data":{"our_suggestion":{"id":399858,"issue_id":24000036,"key":"our_suggestion","value":"Paytm First Membership is valid for a period of 1 year from the date of purchase. To check the validity of your Paytm First Membership, go the \'Profile\' section of the Paytm app (menu on extreme top left) and click on Paytm First, to view the validity mentioned on the top","file":""}},"display_text":"How do I check the validity of my Paytm First Membership?"}]}'
If you're using Requests, you can use the json() method on the response object, like so:
import requests
url = r"https://fulfillment.paytm.com/v2/issues?is_cst=1&is_bank=0&parent_issue_id=24000001"
response = requests.get(url)
json_dict = response.json()
for item in json_dict["reasonObjs"]:
issue_text = item["issue_text"] # or item.get("issue_text", "*no issue text*")
print(issue_text)
Output:
My order is pending for a long time
My order is pending for a long time
My order is pending for a long time
My order is pending for a long time
My order is pending for a long time
I am unable to cancel my order
I am unable to cancel my order
I am unable to cancel my order
I am unable to cancel my order
I am unable to cancel my order
I am unable to cancel my order
I cannot find invoice for purchase of membership
How do I check the validity of my Paytm First Membership?
You could also use the json module:
import json
json_dict = json.loads(response.text)