Jump to content

amrizal15

Members
  • Số lượng nội dung

    4
  • Đã tham gia

  • Lần ghé thăm cuối

Cộng đồng

0 Neutral

Khách vừa ghé thăm

Khách vừa ghé thăm đã bị tắt và không được hiển thị tới những người dùng khác.

  1. You're life saver!!! i'm thinking so hard and dont know how to solve and you solved it like a charm! thank you master now i succesfully login and add to cart, but then i try to post data to checkout but get error 406, in https://shopee.vn/api/v4/cart/checkout i see some req payload data like this : {"selected_shop_order_ids":[{"shopid":350605150,"item_briefs":[{"itemid":5467792469,"modelid":90152275157,"item_group_id":null,"applied_promotion_id":1223949055,"offerid":null,"price":22000000000,"quantity":1,"is_add_on_sub_item":null,"add_on_deal_id":null,"status":1,"cart_item_change_time":1609056840}],"shop_vouchers":[]}],"platform_vouchers":[]}. Then i try to post that data with my code and got result 406, what problem from my code sir ? thanks before rq.cookies.update({"csrftoken": csrf_token}) sp_header2 = {'referer' : 'https://shopee.vn/cart/' , 'content-type' : 'application / json', 'user-agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36' , 'x-api-sourde' : 'pc', 'x-csrftoken' : csrf_token , 'x-requested-with' : 'XMLHttpRequest', 'x-shopee-language' : 'vi' } rq.headers.update(sp_header2) payload2= {"selected_shop_order_ids": [{"shopid":350605150, "item_briefs":[{"itemid":5467792469, "modelid":90152275157, "applied_promotion_id":1223949055, "price":22000000000, "quantity":1, "status":1, "cart_item_change_time":1609056662}], "shop_vouchers":[]}], "platform_vouchers":[]} response2 = rq.post('https://shopee.vn/api/v4/cart/checkout' , data=json.dumps(payload2)) print(response2)
  2. i just want to ask, i try to login with python request and i got this message {"version":"0075c2569e70b86c971eb1a29b9a1265","data":null,"error_msg":null,"error":1} i also test with status_code and that give number 200 that mean ok right ? so what the problem with my code? thanks before
  3. amrizal15

    [Python] Login Shope Got Error Null

    Hi i'm new member and i'm interested with discussion that this forum have and i learn many knowledge from it. i just want to ask, i try to login with python request and i got this message {"version":"0075c2569e70b86c971eb1a29b9a1265","data":null,"error_msg":null,"error":1} i also test with status_code and that give number 200 that mean ok right ? so what the problem with my code? thanks before code: import requests import random import hashlib def random_str(length): character = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' return ''.join((random.choice(character) for i in range ( length ))) def encrypt_pass(password): sha_signature = \ hashlib.sha256((hashlib.md5(password.encode()).hexdigest()).encode()).hexdigest() return sha_signature def main(): username = 'sp_user' password = 'sp_pass' r = requests.Session() response = r.get( 'https://shopee.vn/buyer/login' ) csrftoken_gen = random_str( 32 ) cookie_string = ";" .join([ str(x) + "=" + str(y) for x , y in response.cookies.get_dict().items()]) headers = { 'user-agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.cd36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36' , 'referer' : 'https://shopee.vn' , 'x-csrftoken' : csrftoken_gen , 'x-requested-with' : 'XMLHttpRequest' , 'cookie' : "csrftoken=" + csrftoken_gen + "; " + cookie_string + "SPC_CDS=" + "1" } url = "https://shopee.vn/api/v2/authentication/login" payload = { 'username':username , 'password': encrypt_pass(password), 'support_whats_app': 'true',} response = r.request("POST" , url ,headers=headers,data='{"username":"' + username + '","password":"' + encrypt_pass(password) + '","support_whats_app":true}' ) print (response.text) res = r.request("GET" , "https://shopee.vn/api/v2/user/profile/get/") print(res.content) if __name__ == '__main__' : main()
×
×
  • Create New...