Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create sell order? #9

Open
Anunah9 opened this issue May 9, 2023 · 2 comments
Open

How to create sell order? #9

Anunah9 opened this issue May 9, 2023 · 2 comments

Comments

@Anunah9
Copy link

Anunah9 commented May 9, 2023

I try to create sell order. I log in to the site as in the example. .is_alive_session() specifies true. But when I try to create request, I get the error:

{
  "code": "CSRF Verification Error", 
  "error": "\u0421\u0440\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438\u0441\u0442\u0435\u043a, \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u0435 \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443", 
  "extra": null
}

Code for creating a request for sale:

async def create_sell_offer(buff: Buff):
    url = 'https://buff.163.com/api/market/sell_order/create/manual_plus'
    params = """{"game": "csgo", "assets": [
        {"game": "csgo", "market_hash_name": "Snakebite Case", "contextid": 2, "assetid": "30175988177",
         "classid": "4418618853", "instanceid": "0", "goods_id": 857515, "price": 10, "income": 9.75,
         "has_market_min_price": False, "cdkey_id": ""}]}"""
    response = await buff.request(url, method='POST', params=params)
    print(response)
@sometastycake
Copy link
Owner

sometastycake commented May 9, 2023

@Anunah9 Hello
You received error 'Срок действия страницы истек, обновите текущую страницу'
I think authorization work correctly, but need understand how to work sell orders. You can see in browser dev tools which params send this api. Maybe some additional keys are generated there? I have it in plans

And try to send params as dict, not str

params = {
   "game": "csgo",
   "assets":[
      {
         "game": "csgo",
         "market_hash_name": "Snakebite Case",
         "contextid": 2,
         "assetid": "30175988177",
         "classid": "4418618853",
         "instanceid": "0",
         "goods_id": 857515,
         "price": 10,
         "income": 9.75,
         "has_market_min_price": False,
         "cdkey_id": ""
      }
   ]
}
response = await buff.request(url, method='POST', json=params)

@NiJiSann
Copy link

you need to provide lot more information in headers

Repository owner deleted a comment from SuryaSg Feb 23, 2024
Repository owner deleted a comment from SuryaSg Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants