8000 compatibility with WP 4.7 ( see: 01b5000 ) · jamesbrink/wp-api-python@1860b90 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1860b90

Browse files
author
derwentx
committed
compatibility with WP 4.7 ( see: 01b5000 )
1 parent de39a8a commit 1860b90

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

wordpress/transport.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ def __init__(self, url, **kwargs):
3131
self.timeout = kwargs.get("timeout", 5)
3232
self.verify_ssl = kwargs.get("verify_ssl", True)
3333
self.query_string_auth = kwargs.get("query_string_auth", False)
34-
self.headers = {
35-
"user-agent": "Wordpress API Client-Python/%s" % __version__,
36-
"content-type": "application/json;charset=utf-8",
37-
"accept": "application/json"
38-
}
3934
self.session = Session()
4035

4136
@property
@@ -59,10 +54,17 @@ def endpoint_url(self, endpoint):
5954
])
6055

6156
def request(self, method, url, auth=None, params=None, data=None, **kwargs):
57+
headers = {
58+
"user-agent": "Wordpress API Client-Python/%s" % __version__,
59+
"accept": "application/json"
60+
}
61+
if data is not None:
62+
headers["content-type"] = "application/json;charset=utf-8"
63+
6264
request_kwargs = dict(
6365
method=method,
6466
url=url,
65-
headers=self.headers,
67+
headers=headers,
6668
verify=self.verify_ssl,
6769
timeout=self.timeout,
6870
)

0 commit comments

Comments
 (0)
0