如何使用python将项目添加到discogs库存
我目前正在尝试自动化我的商店。这就是为什么我想通过discogsapi向我的商店添加物品。起初,我尝试了python的官方discogs客户端,但似乎无法添加新项目。我只能提出请求、删除或编辑现有项目。然后我尝试用以下代码发出我自己的post请求,但我总是得到422的响应:如何使用python将项目添加到discogs库存,python,api,post,python-requests,discogs-api,Python,Api,Post,Python Requests,Discogs Api,我目前正在尝试自动化我的商店。这就是为什么我想通过discogsapi向我的商店添加物品。起初,我尝试了python的官方discogs客户端,但似乎无法添加新项目。我只能提出请求、删除或编辑现有项目。然后我尝试用以下代码发出我自己的post请求,但我总是得到422的响应: import requests from requests_oauthlib import OAuth1 auth = OAuth1('YOUR_APP_KEY', 'YOUR_APP_SECRET',
import requests
from requests_oauthlib import OAuth1
auth = OAuth1('YOUR_APP_KEY', 'YOUR_APP_SECRET',
'USER_OAUTH_TOKEN', 'USER_OAUTH_TOKEN_SECRET')
mydata = {'release_id': 9093239,
'condition': 'Mint',
'sleeve_condition' : 'Mint',
'price' : 5.68,
'status' : 'For Sale'}
result = requests.post("https://api.discogs.com/marketplace/listings", json=mydata, auth=auth)
print(result)
或答复400:
result = requests.post("https://api.discogs.com/marketplace/listings", data=mydata, auth=auth)
如果有人能指出我做错了什么,我将不胜感激。谢谢大家的阅读
祝你一切顺利
cpow