{"id":3869,"date":"2022-08-20T21:12:10","date_gmt":"2022-08-20T15:42:10","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/"},"modified":"2022-08-20T21:12:10","modified_gmt":"2022-08-20T15:42:10","slug":"solved-what-does-if-__name__-__main__-do","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/","title":{"rendered":"(Solved) What does if __name__ == &#8220;__main__&#8221;: do?"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-419185\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"419185\" data-parentid=\"419163\" data-score=\"8355\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<h1>Short Answer<\/h1>\n<p>It&#8217;s boilerplate code that protects users from accidentally invoking the script when they didn&#8217;t intend to. Here are some common problems when the guard is omitted from a script:<\/p>\n<ul>\n<li>\n<p>If you import the guardless script in another script (e.g. <code>import my_script_without_a_name_eq_main_guard<\/code>), then the latter script will trigger the former to run <em>at import time<\/em> and <em>using the second script&#8217;s command line arguments<\/em>. This is almost always a mistake.<\/p>\n<\/li>\n<li>\n<p>If you have a custom class in the guardless script and save it to a pickle file, then unpickling it in another script will trigger an import of the guardless script, with the same problems outlined in the previous bullet.<\/p>\n<\/li>\n<\/ul>\n<h1>Long Answer<\/h1>\n<p>To better understand why and how this matters, we need to take a step back to understand how Python initializes scripts and how this interacts with its module import mechanism.<\/p>\n<p>Whenever the Python interpreter reads a source file, it does two things:<\/p>\n<ul>\n<li>\n<p>it sets a few special variables like <code>__name__<\/code>, and then<\/p>\n<\/li>\n<li>\n<p>it executes all of the code found in the file.<\/p>\n<\/li>\n<\/ul>\n<p>Let&#8217;s see how this works and how it relates to your question about the <code>__name__<\/code> checks we always see in Python scripts.<\/p>\n<h2>Code Sample<\/h2>\n<p>Let&#8217;s use a slightly different code sample to explore how imports and scripts work.  Suppose the following is in a file called <code>foo.py<\/code>.<\/p>\n<pre><code># Suppose this is foo.py.\n\nprint(\"before import\")\nimport math\n\nprint(\"before function_a\")\ndef function_a():\n    print(\"Function A\")\n\nprint(\"before function_b\")\ndef function_b():\n    print(\"Function B {}\".format(math.sqrt(100)))\n\nprint(\"before __name__ guard\")\nif __name__ == '__main__':\n    function_a()\n    function_b()\nprint(\"after __name__ guard\")\n<\/code><\/pre>\n<h2>Special Variables<\/h2>\n<p>When the Python interpreter reads a source file, it first defines a few special variables. In this case, we care about the <code>__name__<\/code> variable.<\/p>\n<p><strong>When Your Module Is the Main Program<\/strong><\/p>\n<p>If you are running your module (the source file) as the main program, e.g.<\/p>\n<pre><code>python foo.py\n<\/code><\/pre>\n<p>the interpreter will assign the hard-coded string <code>\"__main__\"<\/code> to the <code>__name__<\/code> variable, i.e.<\/p>\n<pre><code># It's as if the interpreter inserts this at the top\n# of your module when run as the main program.\n__name__ = \"__main__\" \n<\/code><\/pre>\n<p><strong>When Your Module Is Imported By Another<\/strong><\/p>\n<p>On the other hand, suppose some other module is the main program and it imports your module. This means there&#8217;s a statement like this in the main program, or in some other module the main program imports:<\/p>\n<pre><code># Suppose this is in some other main program.\nimport foo\n<\/code><\/pre>\n<p>The interpreter will search for your <code>foo.py<\/code> file (along with searching for a few other variants), and prior to executing that module, it will assign the name <code>\"foo\"<\/code> from the import statement to the <code>__name__<\/code> variable, i.e.<\/p>\n<pre><code># It's as if the interpreter inserts this at the top\n# of your module when it's imported from another module.\n__name__ = \"foo\"\n<\/code><\/pre>\n<h2>Executing the Module&#8217;s Code<\/h2>\n<p>After the special variables are set up, the interpreter executes all the code in the module, one statement at a time. You may want to open another window on the side with the code sample so you can follow along with this explanation.<\/p>\n<p><strong>Always<\/strong><\/p>\n<ol>\n<li>\n<p>It prints the string <code>\"before import\"<\/code> (without quotes).<\/p>\n<\/li>\n<li>\n<p>It loads the <code>math<\/code> module and assigns it to a variable called <code>math<\/code>. This is equivalent to replacing <code>import math<\/code> with the following (note that <code>__import__<\/code> is a low-level function in Python that takes a string and triggers the actual import):<\/p>\n<\/li>\n<\/ol>\n<pre><code># Find and load a module given its string name, \"math\",\n# then assign it to a local variable called math.\nmath = __import__(\"math\")\n<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>It prints the string <code>\"before function_a\"<\/code>.<\/p>\n<\/li>\n<li>\n<p>It executes the <code>def<\/code> block, creating a function object, then assigning that function object to a variable called <code>function_a<\/code>.<\/p>\n<\/li>\n<li>\n<p>It prints the string <code>\"before function_b\"<\/code>.<\/p>\n<\/li>\n<li>\n<p>It executes the second <code>def<\/code> block, creating another function object, then assigning it to a variable called <code>function_b<\/code>.<\/p>\n<\/li>\n<li>\n<p>It prints the string <code>\"before __name__ guard\"<\/code>.<\/p>\n<\/li>\n<\/ol>\n<p><strong>Only When Your Module Is the Main Program<\/strong><\/p>\n<ol start=\"8\">\n<li>If your module is the main program, then it will see that <code>__name__<\/code> was indeed set to <code>\"__main__\"<\/code> and it calls the two functions, printing the strings <code>\"Function A\"<\/code> and <code>\"Function B 10.0\"<\/code>.<\/li>\n<\/ol>\n<p><strong>Only When Your Module Is Imported by Another<\/strong><\/p>\n<ol start=\"8\">\n<li>(<strong>instead<\/strong>) If your module is not the main program but was imported by another one, then <code>__name__<\/code> will be <code>\"foo\"<\/code>, not <code>\"__main__\"<\/code>, and it&#8217;ll skip the body of the <code>if<\/code> statement.<\/li>\n<\/ol>\n<p><strong>Always<\/strong><\/p>\n<ol start=\"9\">\n<li>It will print the string <code>\"after __name__ guard\"<\/code> in both situations.<\/li>\n<\/ol>\n<p><em><strong>Summary<\/strong><\/em><\/p>\n<p>In summary, here&#8217;s what&#8217;d be printed in the two cases:<\/p>\n<pre class=\"lang-none prettyprint-override\"><code># What gets printed if foo is the main program\nbefore import\nbefore function_a\nbefore function_b\nbefore __name__ guard\nFunction A\nFunction B 10.0\nafter __name__ guard\n<\/code><\/pre>\n<pre class=\"lang-none prettyprint-override\"><code># What gets printed if foo is imported as a regular module\nbefore import\nbefore function_a\nbefore function_b\nbefore __name__ guard\nafter __name__ guard\n<\/code><\/pre>\n<h2>Why Does It Work This Way?<\/h2>\n<p>You might naturally wonder why anybody would want this.  Well, sometimes you want to write a <code>.py<\/code> file that can be both used by other programs and\/or modules as a module, and can also be run as the main program itself.  Examples:<\/p>\n<ul>\n<li>\n<p>Your module is a library, but you want to have a script mode where it runs some unit tests or a demo.<\/p>\n<\/li>\n<li>\n<p>Your module is only used as a main program, but it has some unit tests, and the testing framework works by importing <code>.py<\/code> files like your script and running special test functions. You don&#8217;t want it to try running the script just because it&#8217;s importing the module.<\/p>\n<\/li>\n<li>\n<p>Your module is mostly used as a main program, but it also provides a programmer-friendly API for advanced users.<\/p>\n<\/li>\n<\/ul>\n<p>Beyond those examples, it&#8217;s elegant that running a script in Python is just setting up a few magic variables and importing the script. &#8220;Running&#8221; the script is a side effect of importing the script&#8217;s module.<\/p>\n<h2>Food for Thought<\/h2>\n<ul>\n<li>\n<p>Question: Can I have multiple <code>__name__<\/code> checking blocks?  Answer: it&#8217;s strange to do so, but the language won&#8217;t stop you.<\/p>\n<\/li>\n<li>\n<p>Suppose the following is in <code>foo2.py<\/code>.  What happens if you say <code>python foo2.py<\/code> on the command-line? Why?<\/p>\n<\/li>\n<\/ul>\n<pre class=\"lang-py prettyprint-override\"><code># Suppose this is foo2.py.\nimport os, sys; sys.path.insert(0, os.path.dirname(__file__)) # needed for some interpreters\n\ndef function_a():\n    print(\"a1\")\n    from foo2 import function_b\n    print(\"a2\")\n    function_b()\n    print(\"a3\")\n\ndef function_b():\n    print(\"b\")\n\nprint(\"t1\")\nif __name__ == \"__main__\":\n    print(\"m1\")\n    function_a()\n    print(\"m2\")\nprint(\"t2\")\n      \n<\/code><\/pre>\n<ul>\n<li>Now, figure out what will happen if you remove the <code>__name__<\/code> check in <code>foo3.py<\/code>:<\/li>\n<\/ul>\n<pre class=\"lang-py prettyprint-override\"><code># Suppose this is foo3.py.\nimport os, sys; sys.path.insert(0, os.path.dirname(__file__)) # needed for some interpreters\n\ndef function_a():\n    print(\"a1\")\n    from foo3 import function_b\n    print(\"a2\")\n    function_b()\n    print(\"a3\")\n\ndef function_b():\n    print(\"b\")\n\nprint(\"t1\")\nprint(\"m1\")\nfunction_a()\nprint(\"m2\")\nprint(\"t2\")\n<\/code><\/pre>\n<ul>\n<li>What will this do when used as a script?  When imported as a module?<\/li>\n<\/ul>\n<pre class=\"lang-py prettyprint-override\"><code># Suppose this is in foo4.py\n__name__ = \"__main__\"\n\ndef bar():\n    print(\"bar\")\n    \nprint(\"before __name__ guard\")\nif __name__ == \"__main__\":\n    bar()\nprint(\"after __name__ guard\")\n<\/code><\/pre>\n<\/p><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\">21<\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved What does if __name__ == &#8220;__main__&#8221;: do? <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] Short Answer It&#8217;s boilerplate code that protects users from accidentally invoking the script when they didn&#8217;t intend to. Here are some common problems when the guard is omitted from a script: If you import the guardless script in another script (e.g. import my_script_without_a_name_eq_main_guard), then the latter script will trigger the former to run at &#8230; <a title=\"(Solved) What does if __name__ == &#8220;__main__&#8221;: do?\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/\" aria-label=\"More on (Solved) What does if __name__ == &#8220;__main__&#8221;: do?\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[411,406,409,349,410],"class_list":["post-3869","post","type-post","status-publish","format-standard","hentry","category-solved","tag-idioms","tag-namespaces","tag-program-entry-point","tag-python","tag-python-module"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>(Solved) What does if __name__ == &quot;__main__&quot;: do? - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"(Solved) What does if __name__ == &quot;__main__&quot;: do? - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] Short Answer It&#8217;s boilerplate code that protects users from accidentally invoking the script when they didn&#8217;t intend to. Here are some common problems when the guard is omitted from a script: If you import the guardless script in another script (e.g. import my_script_without_a_name_eq_main_guard), then the latter script will trigger the former to run at ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-20T15:42:10+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"(Solved) What does if __name__ == &#8220;__main__&#8221;: do?\",\"datePublished\":\"2022-08-20T15:42:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/\"},\"wordCount\":843,\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"keywords\":[\"idioms\",\"namespaces\",\"program-entry-point\",\"python\",\"python-module\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/\",\"url\":\"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/\",\"name\":\"(Solved) What does if __name__ == \\\"__main__\\\": do? - JassWeb\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#website\"},\"datePublished\":\"2022-08-20T15:42:10+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/jassweb.com\/solved\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"(Solved) What does if __name__ == &#8220;__main__&#8221;: do?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jassweb.com\/solved\/#website\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/jassweb.com\/solved\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"contentUrl\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586\",\"contentUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\/\/jassweb.com\"],\"url\":\"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"(Solved) What does if __name__ == \"__main__\": do? - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/","og_locale":"en_US","og_type":"article","og_title":"(Solved) What does if __name__ == \"__main__\": do? - JassWeb","og_description":"[ad_1] Short Answer It&#8217;s boilerplate code that protects users from accidentally invoking the script when they didn&#8217;t intend to. Here are some common problems when the guard is omitted from a script: If you import the guardless script in another script (e.g. import my_script_without_a_name_eq_main_guard), then the latter script will trigger the former to run at ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/","og_site_name":"JassWeb","article_published_time":"2022-08-20T15:42:10+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"(Solved) What does if __name__ == &#8220;__main__&#8221;: do?","datePublished":"2022-08-20T15:42:10+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/"},"wordCount":843,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["idioms","namespaces","program-entry-point","python","python-module"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/","url":"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/","name":"(Solved) What does if __name__ == \"__main__\": do? - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2022-08-20T15:42:10+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-what-does-if-__name__-__main__-do\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"(Solved) What does if __name__ == &#8220;__main__&#8221;: do?"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/3869","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=3869"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/3869\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=3869"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=3869"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=3869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}