Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Sign up
Appearance settings

Add request session#82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
rooprob wants to merge1 commit intowoocommerce:trunk
base:trunk
Choose a base branch
Loading
fromrooprob:76-add-request-session
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletionwoocommerce/api.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,7 @@
__license__ = "MIT"

from requests import request
from requests import Session
from json import dumps as jsonencode
from time import time
from woocommerce.oauth import OAuth
Expand All@@ -31,6 +32,7 @@ def __init__(self, url, consumer_key, consumer_secret, **kwargs):
self.verify_ssl = kwargs.get("verify_ssl", True)
self.query_string_auth = kwargs.get("query_string_auth", False)
self.user_agent = kwargs.get("user_agent", f"WooCommerce-Python-REST-API/{__version__}")
self.s = Session()

def __is_ssl(self):
""" Check if url use HTTPS """
Expand DownExpand Up@@ -89,7 +91,7 @@ def __request(self, method, endpoint, data, params=None, **kwargs):
data = jsonencode(data, ensure_ascii=False).encode('utf-8')
headers["content-type"] = "application/json;charset=utf-8"

return request(
returnself.s.request(
method=method,
url=url,
verify=self.verify_ssl,
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp