Em đang tìm hiểu để code đoạn login python, em có xem code ở bài này :
import requests
import random
import hashlib
def csrftoken(length=32):# put your letters in the following string
character='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'return''.join((random.choice(character)for i in range(length)))def encrypt_SHA256(password):
sha_signature = \
hashlib.sha256(password.encode()).hexdigest()return sha_signature
def main():
url ='https://banhang.shopee.vn/api/v1/login/'
r = requests.get(url)
arr =["SPC_EC","SPC_F","SPC_R_T_ID","SPC_R_T_IV","SPC_SI","SPC_U","REC_T_ID","SPC_IA","SPC_T_ID","SPC_T_IV"]
cookie_string =""for x in arr:
cookie_string += x + r.cookies[x]+" "
headers ={'x-csrftoken': csrftoken(),'x-requested-with':'XMLHttpRequest','referer':'https://banhang.shopee.vn/api/v1/login/','cookie':"csrftoken="+ csrftoken()+"; "+ cookie_string,}print(headers)
data ={"login_key":"Shopee_username","login_type":"username","password_hash": encrypt_SHA256(password="Shopee_pwd"),"captcha":"","remember_me":True}#print(data)
url="https://banhang.shopee.vn/api/v1/login/"
response = requests.post(url,headers =headers, data=data)
url2="https://banhang.shopee.vn/api/v1/login/"
res = requests.request("GET", url = url2)print(res)if __name__ =='__main__':
main()
Em có login thử trên shopee và check thì thấy nó request về api này : https://shopee.vn/api/v2/authentication/login
Và password khi em encrypt và shopee encrypt củng hoàn toàn khác nhau.
số kí tự thì bằng nhau.
Hi mọi người !
Em đang tìm hiểu để code đoạn login python, em có xem code ở bài này :
Em có login thử trên shopee và check thì thấy nó request về api này : https://shopee.vn/api/v2/authentication/login
Và password khi em encrypt và shopee encrypt củng hoàn toàn khác nhau.
số kí tự thì bằng nhau.
Không biết anh em đã từng làm chưa ạ !
Giúp em với ạ.
Chia sẻ bài đăng này
Link tới bài viết
Share on other sites