{"id":2791,"date":"2020-09-02T18:43:30","date_gmt":"2020-09-02T13:13:30","guid":{"rendered":"https:\/\/copyassignment.com\/?page_id=2791"},"modified":"2023-04-24T07:44:04","modified_gmt":"2023-04-24T02:14:04","slug":"exception-handling-in-python","status":"publish","type":"page","link":"https:\/\/copyassignment.com\/python\/exception-handling-in-python\/","title":{"rendered":"Exception Handling In Python"},"content":{"rendered":"\n\n\n<h2 class=\"wp-block-heading\">Definition<\/h2>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-red-color\">Exception Handling In <\/span><\/strong><span class=\"has-inline-color has-vivid-red-color\"><strong><a href=\"https:\/\/www.python.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Python<\/a><\/strong> <\/span>is one of the features of OOPS. It is mainly designed to handle <strong><span class=\"has-inline-color has-vivid-red-color\">runtime errors<\/span><\/strong> and the <strong><span class=\"has-inline-color has-vivid-red-color\">exceptions <\/span><\/strong>that <strong><span class=\"has-inline-color has-vivid-red-color\">corrupt <\/span><\/strong>the flow of the program. The general format is the usage of &#8220;<strong><span class=\"has-inline-color has-vivid-red-color\">try<\/span><\/strong>&#8221; and &#8220;<strong><span class=\"has-inline-color has-vivid-red-color\">except<\/span><\/strong>&#8221; keywords. There may be some <strong><span class=\"has-inline-color has-vivid-red-color\">block of code<\/span><\/strong> that may get an error during the <strong><span class=\"has-inline-color has-vivid-red-color\">runtime <\/span><\/strong>so we run that code inside the try block and if the code gets <strong><span class=\"has-inline-color has-vivid-red-color\">interrupted <\/span><\/strong>by any errors, it leaves the block and goes to the <strong><span class=\"has-inline-color has-vivid-red-color\">except block<\/span><\/strong>.<\/p>\n\n\n\n<div class=\"maindiv\"><h2>Syntax:<\/h2><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">try:\n    statements\nexcept:\n    statements\n<\/pre><\/strong>\n<\/div><\/div>\n\n\n\n<div class=\"maindiv\"><h3>Example<\/h3><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">try:\n    a = 5\n    b = 0\n    print(a\/b)\nexcept:\n    print(\"ZeroDivision Error\")\n<\/pre><\/strong>\n<\/div><h3>Output<\/h3><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">ZeroDivision Error<\/pre><\/strong><\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Explanation:<\/strong><\/h3>\n\n\n\n<p>In the <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">try block<\/mark><\/strong>, the number is <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">divided by zero<\/mark><\/strong> which faces an exception and moves to the except. Here, no specific error type is found, and prints the message passed in the except block.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Keywords used with Exception Handling<\/h2>\n\n\n\n<p><strong>There are 5 keywords that are mainly used in exception handling&#8211;<\/strong><\/p>\n\n\n\n<ul class=\"myfontsize wp-block-list\">\n<li><strong><span class=\"has-inline-color has-vivid-red-color\">Try<\/span><\/strong><\/li>\n\n\n\n<li><strong><span class=\"has-inline-color has-vivid-red-color\">Except<\/span><\/strong><\/li>\n\n\n\n<li><strong><span class=\"has-inline-color has-vivid-red-color\">Else<\/span><\/strong><\/li>\n\n\n\n<li><strong><span class=\"has-inline-color has-vivid-red-color\">Finally<\/span><\/strong><\/li>\n\n\n\n<li><strong><span class=\"has-inline-color has-vivid-red-color\">raise<\/span><\/strong><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Handling Common Errors<\/strong><\/h2>\n\n\n\n<p><strong>Some of the common types of errors that can be easily handled in Python are&#8211;<\/strong><\/p>\n\n\n\n<ul class=\"myfontsize wp-block-list\">\n<li><strong><span class=\"has-inline-color has-vivid-red-color\">Arithmetic error<\/span><\/strong> \u2013 occurs when the arithmetic calculations fail.<\/li>\n\n\n\n<li><strong><span class=\"has-inline-color has-vivid-red-color\">Overflow error<\/span><\/strong> \u2013 occurs when the input size exceeds the initialized size of the variable.<\/li>\n\n\n\n<li><strong><span class=\"has-inline-color has-vivid-red-color\">Floating-point error<\/span><\/strong> \u2013 occurs when the calculation of floating-point values fails.<\/li>\n\n\n\n<li><strong><span class=\"has-inline-color has-vivid-red-color\">Zero division error<\/span><\/strong> \u2013 occurs when the number is divided by zero.<\/li>\n\n\n\n<li><strong><span class=\"has-inline-color has-vivid-red-color\">Import error<\/span><\/strong> \u2013 occurs when the import file is wrong or mismatched.<\/li>\n\n\n\n<li><strong><span class=\"has-inline-color has-vivid-red-color\">Key error<\/span><\/strong> \u2013 occurs when the key is not found or mismatched in the dictionary.<\/li>\n\n\n\n<li><strong><span class=\"has-inline-color has-vivid-red-color\">Name error<\/span><\/strong> &#8211;&nbsp; occurs when the variable name is not found or mismatched.<\/li>\n\n\n\n<li><strong><span class=\"has-inline-color has-vivid-red-color\">Syntax error<\/span><\/strong> \u2013 occurs when the syntax for the logic used is wrong.<\/li>\n\n\n\n<li><strong><span class=\"has-inline-color has-vivid-red-color\">Type Error<\/span><\/strong> \u2013 occurs when the data types of the variables do not match.<\/li>\n\n\n\n<li><strong><span class=\"has-inline-color has-vivid-red-color\">IO error<\/span><\/strong> \u2013 occurs when the input or output acts as expected.<\/li>\n\n\n\n<li><strong><span class=\"has-inline-color has-vivid-red-color\">Value error<\/span><\/strong> \u2013 occurs when the object created to store the value does not exist or fails to store the value.<\/li>\n<\/ul>\n\n\n\n<div class=\"maindiv\"><h3>Example1<\/h3><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">try:\n    a = 10\n    b = \"9\"\n    print(a + b)\nexcept TypeError:\n    print(\"Type error encountered\")\n<\/pre><\/strong>\n<\/div><h3>Output<\/h3><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">Type error encountered<\/pre><\/strong><\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Explanation<\/strong><\/h3>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>The variables a and b<strong> <\/strong>are of not the same type i.e. <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">a is numeric<\/mark><\/strong> and <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">b is a string<\/mark><\/strong>. Thus, there is a difference in the <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">data type<\/mark><\/strong> of the two variables that&#8217;s why the code execution <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">moves <\/mark><\/strong>to the <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">except block<\/mark><\/strong> where the error is identified and prints the <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">TypeError<\/mark><\/strong> message.<\/p>\n\n\n\n<div class=\"maindiv\"><h3>Example2<\/h3><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">try:\n    a=10\n    b='9'\n    c=0\n    print(a\/c)\n    print(a+b)\nexcept TypeError:\n    print('Type error encountered')\nexcept ZeroDivisionError:\n    print('Tried to divide the number by zero')\n<\/pre><\/strong>\n<\/div><h3>Output<\/h3><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">Tried to divide the number by zero<\/pre><\/strong><\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Explanation<\/strong><\/h3>\n\n\n\n<p>Here, two statements are present, one is\u00a0&#8220;<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">dividing by zero<\/mark><\/strong>&#8221; and &#8220;<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">adding a number with a string<\/mark><\/strong>&#8220;. In this case, when the <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">first exception(a\/c)<\/mark><\/strong> is found in line 5, the flow of the program is broken and moves to the appropriate <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">except<\/mark><\/strong> section.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The else Keyword<\/h2>\n\n\n\n<p>The <strong><span class=\"has-inline-color has-vivid-red-color\">else keyword<\/span><\/strong> is used after the except block. The code flow is designed in such a way that, if the code does not face any <strong><span class=\"has-inline-color has-vivid-red-color\">exceptions<\/span><\/strong>\/<strong><span class=\"has-inline-color has-vivid-red-color\">runtime errors<\/span><\/strong> then, it moves to the else block after executing the <strong><span class=\"has-inline-color has-vivid-red-color\">try block<\/span><\/strong>, otherwise it goes to the <strong><span class=\"has-inline-color has-vivid-red-color\">except block<\/span><\/strong> and <strong><span class=\"has-inline-color has-vivid-red-color\">halts <\/span><\/strong>the execution of the program.<\/p>\n\n\n\n<div class=\"maindiv\"><h2>Syntax:<\/h2><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">try :\n     statements\nexcept:\n     statements\nelse:\n     statements\n<\/pre><\/strong>\n<\/div><\/div>\n\n\n\n<p><strong>Now, let&#8217;s see examples&#8211;<\/strong><\/p>\n\n\n\n<div class=\"maindiv\"><h3>Example1<\/h3><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">try:\n    a=10\n    b=0\n    c=4\n    print(a\/c)\nexcept ZeroDivisionError:\n    print('Tried to divide the number by zero')\nelse:\n    print('No exception found.. Entered else part')\n<\/pre><\/strong>\n<\/div><h3>Output<\/h3><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">2.5\nNo exception found.. Entered else part<\/pre><\/strong><\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Explanation<\/strong><\/h3>\n\n\n\n<p>The variables <strong><span class=\"has-inline-color has-vivid-red-color\">a <\/span><\/strong>and<strong><span class=\"has-inline-color has-vivid-red-color\"> c <\/span><\/strong>are <strong><span class=\"has-inline-color has-vivid-red-color\">divided <\/span><\/strong>since the value of both are <strong><span class=\"has-inline-color has-vivid-red-color\">not 0 <\/span><\/strong>so it does not face exception and enter the <strong><span class=\"has-inline-color has-vivid-red-color\">else part<\/span><\/strong>.<\/p>\n\n\n\n<div class=\"maindiv\"><h3>Example2<\/h3><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">try:\n    a=10\n    b=0\n    c=4\n    print(a\/b)\nexcept ZeroDivisionError:\n    print('Tried to divide the number by zero')\nelse:\n    print('No exception found.. Entered else part')\n<\/pre><\/strong>\n<\/div><h3>Output<\/h3><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">Tried to divide the number by zero<\/pre><\/strong><\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Explanation<\/strong><\/h3>\n\n\n\n<p>Since the value of <strong><span class=\"has-inline-color has-vivid-red-color\">b <\/span><\/strong>is <strong><span class=\"has-inline-color has-vivid-red-color\">0<\/span><\/strong>, it faces the <strong><span class=\"has-inline-color has-vivid-red-color\">zero division error<\/span><\/strong> and does not enter the <strong><span class=\"has-inline-color has-vivid-red-color\">else <\/span><\/strong>section.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The <strong>Finally Keyword<\/strong><\/h2>\n\n\n\n<p>The <strong><span class=\"has-inline-color has-vivid-red-color\">finally keyword<\/span><\/strong> is placed at the end of the program. It will be executed no matter exception occurs or not.<\/p>\n\n\n\n<div class=\"maindiv\"><h2>Syntax:<\/h2><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">try :\n    statements\nexcept:\n    statements\nfinally:\n    statements\n<\/pre><\/strong>\n<\/div><\/div>\n\n\n\n<p><strong>Let&#8217;s see an example&#8211;<\/strong><\/p>\n\n\n\n<div class=\"maindiv\"><h3>Example<\/h3><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">try:\n    a=10\n    b=0\n    c=4\n    print(a\/b)\nexcept ZeroDivisionError:\n    print('Tried to divide the number by zero')\nelse:\n    print('No exception found.. Entered else part')\nfinally:\n    print('Entered finally.. End of the program')\n<\/pre><\/strong>\n<\/div><h3>Output<\/h3><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">Tried to divide the number by zero\nEntered finally.. End of the program<\/pre><\/strong><\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Explanation<\/strong><\/h3>\n\n\n\n<p>The program starts with the <strong><span class=\"has-inline-color has-vivid-red-color\">try block<\/span><\/strong>, since the number is <strong><span class=\"has-inline-color has-vivid-red-color\">divided by zero<\/span><\/strong> it faces the <strong><span class=\"has-inline-color has-vivid-red-color\">exception<\/span><\/strong>. Due to the exception, it does not move to the <strong><span class=\"has-inline-color has-vivid-red-color\">else block<\/span><\/strong> but executes the <strong><span class=\"has-inline-color has-vivid-red-color\">finally block<\/span><\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The <strong>Raise<\/strong> Keyword<\/h2>\n\n\n\n<p>The <strong><span class=\"has-inline-color has-vivid-red-color\">built-in exceptions<\/span><\/strong> can be handled <strong><span class=\"has-inline-color has-vivid-red-color\">implicitly<\/span><\/strong>. But, Python also allows the user to trigger the exception i.e. the user can <strong><span class=\"has-inline-color has-vivid-red-color\">specify <\/span><\/strong>at what <strong><span class=\"has-inline-color has-vivid-red-color\">condition <\/span><\/strong>of the block the exception must be carried out.<\/p>\n\n\n\n<div class=\"maindiv\"><h2>Syntax:<\/h2><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">try:\n    condition\n    raise exception\n        statements\nexcept Exception:\n        statements\n<\/pre><\/strong>\n<\/div><\/div>\n\n\n\n<p><strong>Let&#8217;s see an example&#8211;<\/strong><\/p>\n\n\n\n<div class=\"maindiv\"><h3>Example<\/h3><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">try:\n    a=10\n    b=-2\n    if b<0:\n        raise ValueError\n    else:\n        print(a\/b)\nexcept ValueError:\n    print(' Don\u2019t divide by negative number... it will give negative result')<\/pre><\/strong>\n<\/div><h3>Output<\/h3><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">Don\u2019t divide by negative number... it will give negative result<\/pre><\/strong><\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Explanation<\/strong><\/h3>\n\n\n\n<p>In general, the <strong><span class=\"has-inline-color has-vivid-red-color\">value error<\/span><\/strong> occurs the object created to store the value <strong><span class=\"has-inline-color has-vivid-red-color\">does not exist<\/span><\/strong> or <strong><span class=\"has-inline-color has-vivid-red-color\">fails to store<\/span><\/strong> the value, but in this code, the <strong><span class=\"has-inline-color has-vivid-red-color\">ValueError <\/span><\/strong>is <strong><span class=\"has-inline-color has-vivid-red-color\">triggered <\/span><\/strong>when the value of <strong><span class=\"has-inline-color has-vivid-red-color\">b<\/span><\/strong> is <strong><span class=\"has-inline-color has-vivid-red-color\">negative<\/span><\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Printing the errors<\/h2>\n\n\n\n<p>If we don't know the <strong><span class=\"has-inline-color has-vivid-red-color\">error type<\/span><\/strong> and want to know the error then we can use <strong><span class=\"has-inline-color has-vivid-red-color\">as <\/span><\/strong>keyword to print the error.<\/p>\n\n\n\n<div class=\"maindiv\"><h2>Syntax:<\/h2><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">try:\n    # some code\nexcept Exception as e:\n    print(e)\n<\/pre><\/strong>\n<\/div><\/div>\n\n\n\n<p><strong>Now let's see some examples--<\/strong><\/p>\n\n\n\n<div class=\"maindiv\"><h3>Example<\/h3><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">try:\n  print(12\/0)\nexcept Exception as e:\n  print(e)\n<\/pre><\/strong>\n<\/div><h3>Output<\/h3><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">division by zero<\/pre><\/strong><\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Explanation<\/strong><\/h3>\n\n\n\n<p>In the second line, <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">print(12\/0)<\/mark><\/strong> will give an error so, the program execution goes to except block where we first <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">catch <\/mark><\/strong>the error using <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">as <\/mark><\/strong>keyword and stored the error in the <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">e <\/mark><\/strong>variable, then we simply <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">printed <\/mark><\/strong>the <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">e<\/mark><\/strong>.<\/p>\n\n\n\n<p><strong>Now, what if we have not used try... except... blocks, let's see--<\/strong><\/p>\n\n\n\n<div class=\"maindiv\"><h3>Example<\/h3><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">print(12\/0)\n<\/pre><\/strong>\n<\/div><h3>Output<\/h3><div class=\"codediv\"><strong><pre style=\"color:#cf2e2e;\">Traceback (most recent call last):\n  File \"\/tmp\/sessions\/cc324f5c8863ef98\/main.py\", line 1, in <module>\n    print(12\/0)\nZeroDivisionError: division by zero<\/pre><\/strong><\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Explanation<\/strong><\/h3>\n\n\n\n<p>Here, we have tried to print the value which will occur due to <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">12\/0<\/mark><\/strong> which is an <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">error<\/mark><\/strong> obviously, and the program <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">terminates <\/mark><\/strong>with an error, while in the above example, we have <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">printed <\/mark><\/strong>the error by using <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">try-except<\/mark><\/strong> block and <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">as keyword<\/mark><\/strong>.<\/p>\n\n\n\n<div class=\"wp-block-buttons is-horizontal is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-499968f5 wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background wp-element-button\" href=\"https:\/\/copyassignment.com\/python\/json-with-python\/\" style=\"color:#ffffff;background-color:#4caf50\">Previous-- Python JSON<\/a><\/div>\n\n\n\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background wp-element-button\" href=\"https:\/\/copyassignment.com\/python\/regular-expression-in-python-regex\/\" style=\"color:#ffffff;background-color:#4caf50\">Next-- Python Regular Expressions<\/a><\/div>\n<\/div>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n","protected":false},"excerpt":{"rendered":"<p>Definition Exception Handling In Python is one of the features of OOPS. It is mainly designed to handle runtime errors and the exceptions that corrupt&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":833,"menu_order":22,"comment_status":"closed","ping_status":"closed","template":"template-s1-c-page.php","meta":{"footnotes":""},"class_list":["post-2791","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/pages\/2791","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/comments?post=2791"}],"version-history":[{"count":0,"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/pages\/2791\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/pages\/833"}],"wp:attachment":[{"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/media?parent=2791"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}