Skip to content

Instantly share code, notes, and snippets.

Last active March 28, 2017 08:23
What would you like to do?
【Python】eBayのTrading APIを使ってeBayのユーザーからの問い合わせを取得する方法
import datetime
import logging
import re
from import Connection as Trading
from ebaysdk.exception import ConnectionError
if __name__ == "__main__":
params = {
'DetailLevel': 'ReturnHeaders',
api = Trading(appid="YOUR_APPID", devid="YOUR_DEVID", certid="YOUR_CERTID", token="YOUR_AUTH_TOKEN")
api.execute('GetMyMessages', params)
for message in api.response.reply.Messages.Message:
# eBayからのメッセージはスルー
if message.Sender == 'eBay':
data = {
"sending_user_id": message.SendingUserID,
"sender": message.sender,
"message_id": message.MessageID,
"receive_data": message.ReceiveDate,
"subject": message.Subject,
except ConnectionError as e:
d ="%Y/%m/%d %H:%M:%S")
print("{} {}".format(d, e))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment