{"id":221540,"date":"2020-12-04T13:31:04","date_gmt":"2020-12-04T05:31:04","guid":{"rendered":"http:\/\/4563.org\/?p=221540"},"modified":"2020-12-04T13:31:04","modified_gmt":"2020-12-04T05:31:04","slug":"%e8%bf%99%e4%b8%aa%e5%91%bd%e4%bb%a4%e7%94%a8-requests-%e6%80%8e%e4%b9%88%e5%86%99%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=221540","title":{"rendered":"\u8fd9\u4e2a\u547d\u4ee4\u7528 requests \u600e\u4e48\u5199\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u8fd9\u4e2a\u547d\u4ee4\u7528 requests \u600e\u4e48\u5199\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : imn1 <\/span>  <span><i><\/i> 2<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        curl -X PROPFIND -u login -H &#8220;Content-Type: text\/xml&#8221; -H &#8220;Depth: 1&#8221; <br \/> &#8211;data &#8220;&lt;propfind xmlns=&#8217;DAV:&#8217;&gt;&lt;prop&gt;&lt;calendar-data xmlns=&#8217;urn:ietf:params:xml:ns:caldav&#8217;\/&gt;&lt;\/prop&gt;&lt;\/propfind&gt;&#8221; <br \/> https:\/\/myserver\/joe\/home\/<\/p>\n<p>\u8c22\u4e86       <\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>8<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4476964\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : aonshuy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             https:\/\/curl.trillworks.com\/                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4476965\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : imn1 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @aonshuy <br \/>\u8fd9\u5e74\u5934\u771f\u662f\u53ea\u6709\u60f3\u4e0d\u5230\u7684\u2026\u2026                                                             <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4476966\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : justin2018 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             https:\/\/curl.trillworks.com\/<\/p>\n<p>import requests<\/p>\n<p>headers = {<br \/> &#8216;Content-Type&#8217;: &#8216;text\/xml&#8217;,<br \/> &#8216;Depth&#8217;: &#8216;1&#8217;,<br \/>}<\/p>\n<p>data = {<br \/> &#8216;&lt;propfind xmlns&#8217;: &#8221;DAV:&#8217;&gt;&lt;prop&gt;&lt;calendar-data xmlns=&#8217;urn:ietf:params:xml:ns:caldav&#8217;\/&gt;&lt;\/prop&gt;&lt;\/propfind&gt;&#8217;<br \/>}<\/p>\n<p>response = requests.post(&#8216;https:\/\/myserver\/joe\/home\/&#8217;, headers=headers, data=data, auth=(&#8216;login&#8217;, &#8221;))                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4476967\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ysc3839 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @aonshuy @justin2018 <br \/>\u8fd9\u4e2a\u7f51\u7ad9\u8f6c\u51fa\u6765\u4f3c\u4e4e\u662f\u9519\u7684\uff0c\u5ffd\u7565\u4e86 PROPFIND method \u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4476968\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : no1xsyzy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ysc3839 \u53bb\u63d0\u4e2a issue \u5457<br \/>\u4e34\u65f6\u89e3\u51b3\u7684\u8bdd\uff0c\u5e94\u8be5\u8fd8\u662f\u7528 requests.request(&#8216;PROPFIND&#8217;, &#8230;)<br \/>\u9664\u6b64\u4ee5\u5916\uff0c\u76f4\u63a5 PyPI \u4e0a\u627e\u627e WebDAV \u5e93\u5457                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4476969\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : imn1 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @no1xsyzy #5<br \/>\u6ca1\u641c\u5230 py3 \u53ef\u7528\u7684 carddav\uff0ccaldav \u90a3\u4e2a\u8fd8\u597d\uff0c\u53ea\u662f\u5b83\u4ec5\u6709 caldav\uff0c\u4ee3\u7801\u770b\u5f97\u6709\u70b9\u6655\uff0c\u60f3\u7ee7\u6210\u8fc7\u6765\u517c\u5bb9 carddav \u6ca1\u641e\u5b9a<br \/>\u53ea\u662f\u6211\u9700\u6c42\u6ca1\u90a3\u4e48\u590d\u6742\uff0c\u81ea\u7528\u4e0d\u9700\u8981\u7406\u4f1a\u5404\u79cd rfc \u6807\u51c6\uff0c\u5206\u6790\u51fa\u5b57\u6bb5\u80fd\u8bfb\u80fd\u5199\u5c31\u884c\uff0crequests + vobject \u5c31\u591f\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4476970\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : vone <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u547d\u4ee4\u91cc\u7684 &#8220;-u login&#8221; \u4e0d\u77e5\u9053\u4e3a\u4ec0\u4e48\u88ab postman \u5ffd\u7565\u4e86\uff0c\u6539\u4e3a &#8220;-u login:&#8221;\uff0c\u7136\u540e\u5bfc\u5165 postman\uff0c\u7136\u540e\u751f\u6210\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<p>import requests<\/p>\n<p>url = &#8220;https:\/\/myserver\/joe\/home\/&#8221;<\/p>\n<p>payload=&#8221;&lt;propfind xmlns=&#8217;DAV:&#8217;&gt;&lt;prop&gt;&lt;calendar-data xmlns=&#8217;urn:ietf:params:xml:ns:caldav&#8217;\/&gt;&lt;\/prop&gt;&lt;\/propfind&gt;&#8221;<br \/>headers = {<br \/> &#8216;Content-Type&#8217;: &#8216;text\/xml&#8217;,<br \/> &#8216;Depth&#8217;: &#8216;1&#8217;,<br \/> &#8216;Authorization&#8217;: &#8216;Basic bG9naW46&#8217;<br \/>}<\/p>\n<p>response = requests.request(&#8220;PROPFIND&#8221;, url, headers=headers, data=payload)<\/p>\n<p>print(response.text)<\/p>\n<p>postman \u5bfc\u5165\u65b9\u5f0f\uff1a\u4e3b\u754c\u9762=&gt; Import =&gt; Raw text =&gt; Continue \u3002<\/p>\n<p>https:\/\/i.loli.net\/2020\/12\/06\/5gvcKAYo1qEhrHR.jpg<br \/>https:\/\/i.loli.net\/2020\/12\/06\/9m4abLBcCuysv1W.jpg                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4476971\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : WordTian <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             WEBDAV \u662f HTTP \u7684\u534f\u8bae\u6269\u5c55\uff0crequests \u662f http \u7684\u5e93\uff0c\u7406\u8bba\u4e0a\u5e94\u8be5\u4e0d\u652f\u6301\u7684\u5427                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u4e2a\u547d\u4ee4\u7528 requests \u600e\u4e48&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/221540"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=221540"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/221540\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=221540"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=221540"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=221540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}