{"id":12387571,"date":"2020-02-01T02:51:34","date_gmt":"2020-02-01T02:51:34","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/python-rest-api-example\/"},"modified":"2020-02-01T03:13:55","modified_gmt":"2020-02-01T03:13:55","slug":"python-rest-api-example","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/python-rest-api-example\/","title":{"rendered":"Python REST API Example"},"content":{"rendered":"<p>Hello,<br \/>\nSimilar to <a href=\"https:\/\/wordpress.org\/support\/topic\/it-is-possible-to-get-some-example\/\" rel=\"noopener noreferrer\" target=\"_blank\">this user&#8217;s request<\/a>, I was hoping to find an example of your plugin using Python so a user can authenticate my software on their computer (unless there&#8217;s a safer way to do this). I&#8217;m not sure which address to get or how to find if a license is valid. I looked for docs <a href=\"https:\/\/www.licensemanager.at\/docs\/rest-api\/v2\/\" rel=\"noopener noreferrer\" target=\"_blank\">here<\/a> and <a href=\"https:\/\/www.licensemanager.at\/docs\/tutorials-how-to\/additional-rest-api-validation\/\" rel=\"noopener noreferrer\" target=\"_blank\">here<\/a>, but didn&#8217;t see any. I am using Python&#8217;s <a href=\"https:\/\/requests.readthedocs.io\/en\/master\/user\/authentication\/\" rel=\"noopener noreferrer\" target=\"_blank\">Requests<\/a> library.<\/p>\n<pre><code>\nimport requests\n\ndef main():\n    r = requests.get(&#039;https:\/\/api.github.com\/user&#039;, auth=(&#039;username&#039;, &#039;password&#039;))\n    print r.status_code\n    print r.headers[&#039;content-type&#039;]\n    print r.encoding\n    print r.text\n    print r.json()\n\nif __name__==&#039;__main__&#039;:\n    main()<\/code><\/pre>\n<p>Thank you!<\/p>\n","protected":false},"template":"","class_list":["post-12387571","topic","type-topic","status-publish","hentry","topic-tag-api","topic-tag-python","topic-tag-rest"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12387571","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12387571\/revisions"}],"predecessor-version":[{"id":12387587,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12387571\/revisions\/12387587"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=12387571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}