ログイン
始める

Easy Digital Downloads ドキュメント

Easy Digital Downloads のドキュメント、参考資料、チュートリアル

ソフトウェアライセンスAPI – Pythonを使用した例

このドキュメントは、APIで利用可能なすべての機能がリストされているソフトウェアライセンスAPIドキュメントのサブセットです。以下は、Perlでこれらの機能を実装する方法を示すサンプルコードです。

リクエスト

Python 3:

import requests

payload = {
'edd_action': 'activate_license', # Valid actions are activate_license, deactivate_license, get_version, check_license
'license': '',
'item_id': '', # The ID of the download on your store
'url': 'domain.com' # If you have disabled URL checking in the settings, you do not need this
}

# Domain to send the request to.
r = requests.post("https://yoursite.com/", data=payload)

# Response JSON available via r.json()
print(r.json())

Python 2:

import httplib, urllib

params = urllib.urlencode({
'edd_action' : 'activate_license', # Valid actions are activate_license, deactivate_license, get_version, check_license
'license' : '',
'item_id' : '', # The ID of the download on your store
'url' : 'domain.com' # If you have disabled URL checking in the settings, you do not need this
})

headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
conn = httplib.HTTPConnection("domain.com:80") # You can use 80 (http) or 443 (https)
conn.request("POST", "/", params, headers) # /edd-sl is the Software Licensing API endpoint
response = conn.getresponse()
# You should check response.status for a `200` before proceeding with parsing the data for
# a Software Licensing response
slData = response.read()
# slData now contains a string in JSON format, to handle with however prefer
print slData
conn.close()

レスポンス

上記のクエリに対するレスポンスは、次のようなJSON形式の文字列になります。

{
	"license": "valid",
	"item_name": "EDD Product name",
	"expires": "2014-10-23 00:00:00",
	"payment_id": 54224,
	"customer_name": "John Doe",
	"customer_email": "[email protected]"
}
この記事は役に立ちましたか?

今日から販売を開始しましょう!

50,000人以上のスマートなストアオーナーに参加して、WordPressでデジタル製品を販売する最も簡単な方法を使い始めましょう。

Copyright © 2025 Sandhills Development, LLC

[universally_switcher]