├── README.md ├── bot.py ├── checkoutdata.py ├── cookie.txt ├── images ├── copy_header.png ├── forward_slash.png └── tab_network.png ├── item.py ├── main.py ├── user.py └── user_agent.txt /README.md: -------------------------------------------------------------------------------- 1 | # Requirement 2 | - Python 3.7.x 3 | 4 | Download python di https://www.python.org/downloads/ 5 | # Setup 6 | Install modul `requests` dan `colorama` dengan perintah berikut 7 | ```sh 8 | pip install requests colorama 9 | ``` 10 | jika sudah, buka chrome dan buka https://shopee.co.id/ lalu login. 11 | tekan F12 lalu masuk tab network. 12 | 13 | ![tab network](images/tab_network.png) 14 | 15 | refresh webpage dan cari item `/` 16 | 17 | ![forward slash](images/forward_slash.png) 18 | 19 | klik item lalu klik kanan pada header "cookie" didalam "Request headers" 20 | 21 | ![copy header](images/copy_header.png) 22 | 23 | pilih `copy value`. 24 | 25 | edit cookie.txt lalu paste dan save! 26 | 27 | selesai/sudah siap login 28 | 29 | jalankan scriptnya dengan perintah berikut 30 | ``` 31 | python main.py 32 | ``` 33 | # Tambahan 34 | untuk speed tergantung koneksi internet masing masing. 35 | dan tidak menjamin 100% dapat 36 | -------------------------------------------------------------------------------- /bot.py: -------------------------------------------------------------------------------- 1 | from urllib.parse import urlencode 2 | from item import * 3 | from user import User 4 | from json import dumps 5 | from re import search 6 | from time import time 7 | from checkoutdata import * 8 | import requests 9 | 10 | 11 | class Bot: 12 | user: User 13 | 14 | def __init__(self, user: User): 15 | self.user = user 16 | 17 | def __default_headers(self) -> dict: 18 | return { 19 | "Accept": "application/json", 20 | "Content-Type": "application/json", 21 | "Cookie": self.user.cookie, 22 | "Referer": "https://shopee.co.id/", 23 | "User-Agent": self.user.USER_AGENT, 24 | "X-Csrftoken": self.user.csrf_token, 25 | "if-none-match-": "*" 26 | } 27 | 28 | def fetch_item_from_url(self, url: str) -> Item: 29 | """ 30 | :param url: the item url 31 | :return: Item object 32 | the url will definitely be one of these: 33 | - https://shopee.co.id/product/xxxx/xxxx 34 | - https://shopee.co.id/Item-Name.xxxx.xxxx 35 | """ 36 | # https://shopee.co.id/product/xxxx/xxxx 37 | match = search(r".*/(?P\d+)/(?P\d+).*?", url) 38 | if match is not None: 39 | return self.fetch_item(int(match.group("itemid")), int(match.group("shopid"))) 40 | 41 | # https://shopee.co.id/Item-Name.xxxx.xxxx 42 | match = search(r".*\.(?P\d+)\.(?P\d+)", url) 43 | if match is None: 44 | raise ValueError("unexpected url") 45 | return self.fetch_item(int(match.group("itemid")), int(match.group("shopid"))) 46 | 47 | def fetch_item(self, item_id: int, shop_id: int) -> Item: 48 | resp = requests.get( 49 | "https://shopee.co.id/api/v2/item/get?" + urlencode({ 50 | "itemid": item_id, 51 | "shopid": shop_id 52 | }), 53 | headers=self.__default_headers() 54 | ) 55 | item_data = resp.json()["item"] 56 | if item_data is None: 57 | raise NameError("item not found") 58 | return Item( 59 | item_id=item_data["itemid"], 60 | shop_id=item_data["shopid"], 61 | models=[Model( 62 | currency=model["currency"], 63 | item_id=model["itemid"], 64 | model_id=model["modelid"], 65 | promotion_id=model["promotionid"], 66 | name=model["name"], 67 | price=model["price"], 68 | stock=model["stock"] 69 | ) for model in item_data["models"]], 70 | name=item_data["name"], 71 | price=item_data["price"], 72 | price_before_discount=item_data["price_before_discount"], 73 | brand=item_data["brand"], 74 | shop_location=item_data["shop_location"], 75 | upcoming_flash_sale=UpcomingFlashSaleInfo( 76 | end_time=item_data["upcoming_flash_sale"]["end_time"], 77 | item_id=item_data["upcoming_flash_sale"]["itemid"], 78 | model_ids=item_data["upcoming_flash_sale"]["modelids"], 79 | name=item_data["upcoming_flash_sale"]["name"], 80 | price=item_data["upcoming_flash_sale"]["price"], 81 | price_before_discount=item_data["upcoming_flash_sale"]["price_before_discount"], 82 | promotion_id=item_data["upcoming_flash_sale"]["promotionid"], 83 | shop_id=item_data["upcoming_flash_sale"]["shopid"], 84 | start_time=item_data["upcoming_flash_sale"]["start_time"], 85 | stock=item_data["upcoming_flash_sale"]["stock"] 86 | ) if item_data["upcoming_flash_sale"] is not None else None, 87 | add_on_deal_info=AddOnDealInfo( 88 | add_on_deal_id=item_data["add_on_deal_info"]["add_on_deal_id"], 89 | add_on_deal_label=item_data["add_on_deal_info"]["add_on_deal_label"], 90 | sub_type=item_data["add_on_deal_info"]["sub_type"] 91 | ) if item_data["add_on_deal_info"] is not None else AddOnDealInfo(), 92 | price_min=item_data["price_min"], 93 | price_max=item_data["price_max"], 94 | stock=item_data["stock"], 95 | is_flash_sale=item_data["flash_sale"] is not None 96 | ) 97 | 98 | def add_to_cart(self, item: Item, model_index: int) -> CartItem: 99 | if not item.models[model_index].is_available(): 100 | raise Exception("out of stock") 101 | resp = requests.post( 102 | url="https://shopee.co.id/api/v2/cart/add_to_cart", 103 | headers=self.__default_headers(), 104 | data=dumps({ 105 | "checkout": True, 106 | "client_source": 1, 107 | "donot_add_quantity": False, 108 | "itemid": item.item_id, 109 | "modelid": item.models[model_index].model_id, 110 | "quantity": 1, 111 | "shopid": item.shop_id, 112 | "source": "", 113 | "update_checkout_only": False 114 | }) 115 | ) 116 | data = resp.json() 117 | if data["error"] != 0: 118 | print("modelid:", item.models[0].model_id) 119 | print(resp.text) 120 | raise Exception(f"failed to add to cart {data['error']}") 121 | data = data["data"]["cart_item"] 122 | return CartItem( 123 | add_on_deal_id=item.add_on_deal_info.add_on_deal_id, 124 | item_group_id=str(data["item_group_id"]) if data["item_group_id"] != 0 else None, 125 | item_id=data["itemid"], 126 | model_id=data["modelid"], 127 | price=data["price"], 128 | shop_id=item.shop_id 129 | ) 130 | 131 | def __checkout_get(self, payment: PaymentInfo, item: CartItem) -> CheckoutData: 132 | resp = requests.post( 133 | url="https://shopee.co.id/api/v2/checkout/get", 134 | headers=self.__default_headers(), 135 | # TODO: Implement data 136 | data=dumps({ 137 | "cart_type": 0, 138 | "client_id": 0, 139 | "device_info": { 140 | "buyer_payment_info": {}, 141 | "device_fingerprint": "", 142 | "device_id": "", 143 | "tongdun_blackbox": "" 144 | }, 145 | "dropshipping_info": { 146 | "enabled": False, 147 | "name": "", 148 | "phone_number": "" 149 | }, 150 | "order_update_info": {}, 151 | "promotion_data": { 152 | "auto_apply_shop_voucher": False, 153 | "check_shop_voucher_entrances": True, 154 | "free_shipping_voucher_info": { 155 | "disabled_reason": None, 156 | "free_shipping_voucher_code": "", 157 | "free_shipping_voucher_id": 0 158 | }, 159 | "platform_voucher": [], 160 | "shop_voucher": [], 161 | "use_coins": False 162 | }, 163 | "selected_payment_channel_data": { 164 | "channel_id": payment.channel.value, 165 | "channel_item_option_info": {"option_info": payment.option_info.value}, 166 | "version": 2 167 | }, 168 | "shipping_orders": [{ 169 | "buyer_address_data": { 170 | "address_type": 0, 171 | "addressid": self.user.default_address.id, 172 | "error_status": "", 173 | "tax_address": "" 174 | }, 175 | "buyer_ic_number": "", 176 | "logistics": { 177 | "recommended_channelids": None 178 | }, 179 | "selected_preferred_delivery_instructions": {}, 180 | "selected_preferred_delivery_time_option_id": 0, 181 | "selected_preferred_delivery_time_slot_id": None, 182 | "shipping_id": 1, 183 | "shoporder_indexes": [0], 184 | "sync": True 185 | }], 186 | "shoporders": [{ 187 | "buyer_address_data": { 188 | "address_type": 0, 189 | "addressid": self.user.default_address.id, 190 | "error_status": "", 191 | "tax_address": "" 192 | }, 193 | "items": [{ 194 | "add_on_deal_id": item.add_on_deal_id, 195 | "is_add_on_sub_item": False, 196 | "item_group_id": item.item_group_id, 197 | "itemid": item.item_id, 198 | "modelid": item.model_id, 199 | "quantity": 1 200 | }], 201 | "logistics": { 202 | "recommended_channelids": None 203 | }, 204 | "selected_preferred_delivery_instructions": {}, 205 | "selected_preferred_delivery_time_option_id": 0, 206 | "selected_preferred_delivery_time_slot_id": None, 207 | "shipping_id": 1, 208 | "shop": {"shopid": item.shop_id} 209 | }], 210 | "tax_info": { 211 | "tax_id": "" 212 | }, 213 | "timestamp": time() 214 | }) 215 | ) 216 | 217 | if not resp.ok: 218 | print(resp.status_code) 219 | print(resp.text) 220 | raise Exception("failed to get checkout info") 221 | data = resp.json() 222 | return CheckoutData( 223 | can_checkout=data["can_checkout"], 224 | cart_type=data["cart_type"], 225 | client_id=data["client_id"], 226 | shipping_orders=data["shipping_orders"], 227 | disabled_checkout_info=data["disabled_checkout_info"], 228 | checkout_price_data=data["checkout_price_data"], 229 | promotion_data=data["promotion_data"], 230 | dropshipping_info=data["dropshipping_info"], 231 | selected_payment_channel_data=data["selected_payment_channel_data"], 232 | shoporders=data["shoporders"], 233 | order_update_info=data["order_update_info"], 234 | buyer_txn_fee_info=data["buyer_txn_fee_info"], 235 | timestamp=data["timestamp"] 236 | ) 237 | 238 | def checkout(self, payment: PaymentInfo, item: CartItem): 239 | """ 240 | :param payment: payment method like COD/Alfamart 241 | :param item: the item to checkout 242 | checkout an item that has been added to cart 243 | """ 244 | data = self.__checkout_get(payment, item) 245 | resp = requests.post( 246 | url="https://shopee.co.id/api/v2/checkout/place_order", 247 | headers=self.__default_headers(), 248 | data=dumps({ 249 | "status": 200, 250 | "headers": {}, 251 | "cart_type": data.cart_type, 252 | "shipping_orders": data.shipping_orders, 253 | "disabled_checkout_info": data.disabled_checkout_info, 254 | "timestamp": data.timestamp, 255 | "checkout_price_data": data.checkout_price_data, 256 | "client_id": data.client_id, 257 | "promotion_data": data.promotion_data, 258 | "dropshipping_info": data.dropshipping_info, 259 | "selected_payment_channel_data": data.selected_payment_channel_data, 260 | "shoporders": data.shoporders, 261 | "can_checkout": data.can_checkout, 262 | "order_update_info": data.order_update_info, 263 | "buyer_txn_fee_info": data.buyer_txn_fee_info 264 | }) 265 | ) 266 | if "error" in resp.json(): 267 | print(resp.text) 268 | raise Exception("failed to checkout") 269 | elif resp.status_code == 406: 270 | print(resp.text) 271 | raise Exception("response not acceptable, maybe the item has run out") 272 | elif not resp.ok: 273 | raise Exception(f"failed to checkout, response not ok: {resp.status_code}") 274 | 275 | def buy(self, item: Item, model_index: int, payment: PaymentInfo): 276 | """ 277 | :param item: the item to buy 278 | :param model_index: selected model 279 | :param payment: payment method 280 | just another way to add item to cart and checkout 281 | """ 282 | cart_item = self.add_to_cart(item, model_index) 283 | self.checkout(payment, cart_item) 284 | 285 | def remove_item_from_cart(self, cart_item: CartItem): 286 | """ 287 | :param cart_item: cart item to be removed 288 | remove item from cart 289 | """ 290 | resp = requests.post( 291 | url="https://shopee.co.id/api/v4/cart/update", 292 | headers=self.__default_headers(), 293 | data=dumps({ 294 | "action_type": 2, 295 | "updated_shop_order_ids": [ 296 | { 297 | "item_briefs": [ 298 | { 299 | "add_on_deal_id": cart_item.add_on_deal_id, 300 | "checkout": False, 301 | "item_group_id": cart_item.item_group_id, 302 | "itemid": cart_item.item_id, 303 | "modelid": cart_item.model_id, 304 | "price": cart_item.price, 305 | "shopid": cart_item.shop_id 306 | } 307 | ], 308 | "shopid": cart_item.shop_id 309 | } 310 | ] 311 | }) 312 | ) 313 | if resp.json()["error"] != 0: 314 | raise Exception("failed to remove item from cart") 315 | -------------------------------------------------------------------------------- /checkoutdata.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from enum import Enum 3 | 4 | 5 | class PaymentChannel(Enum): 6 | ALFAMART = 8003200 7 | INDOMART_ISAKU = 8003001 8 | AKULAKU = 8000700 9 | TRANSFER_BANK = 8005200 10 | COD_BAYAR_DI_TEMPAT = 89000 11 | 12 | 13 | class PaymentChannelOptionInfo(Enum): 14 | NONE = "" 15 | # Transfer Bank 16 | TRANSFER_BANK_BCA_AUTO = "89052001" 17 | TRANSFER_BANK_MANDIRI_AUTO = "89052002" 18 | TRANSFER_BANK_BNI_AUTO = "89052003" 19 | TRANSFER_BANK_BRI_AUTO = "89052004" 20 | TRANSFER_BANK_SYARIAH_AUTO = "89052005" 21 | TRANSFER_BANK_PERMATA_AUTO = "89052006" 22 | 23 | # Akulaku 24 | AKULAKU_CICILAN_1X = "8000700-25" 25 | AKULAKU_CICILAN_2X = "8000700-26" 26 | # untested 27 | AKULAKU_CICILAN_3X = "8000700-27" 28 | AKULAKU_CICILAN_6X = "8000700-28" 29 | AKULAKU_CICILAN_9X = "8000700-29" 30 | AKULAKU_CICILAN_12X = "8000700-30" 31 | 32 | 33 | @dataclass 34 | class PaymentInfo: 35 | channel: PaymentChannel 36 | option_info: PaymentChannelOptionInfo = PaymentChannelOptionInfo.NONE 37 | 38 | 39 | @dataclass 40 | class CheckoutData: 41 | can_checkout: bool 42 | cart_type: int 43 | client_id: int 44 | shipping_orders: list 45 | disabled_checkout_info: dict 46 | checkout_price_data: dict 47 | promotion_data: dict 48 | dropshipping_info: dict 49 | selected_payment_channel_data: dict 50 | shoporders: list 51 | order_update_info: dict 52 | buyer_txn_fee_info: dict 53 | timestamp: int 54 | -------------------------------------------------------------------------------- /cookie.txt: -------------------------------------------------------------------------------- 1 | COOKIE -------------------------------------------------------------------------------- /images/copy_header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tatarafiami/fasterbot/16352c7998ec3c1f9305e2a04a23cd0c061803a2/images/copy_header.png -------------------------------------------------------------------------------- /images/forward_slash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tatarafiami/fasterbot/16352c7998ec3c1f9305e2a04a23cd0c061803a2/images/forward_slash.png -------------------------------------------------------------------------------- /images/tab_network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tatarafiami/fasterbot/16352c7998ec3c1f9305e2a04a23cd0c061803a2/images/tab_network.png -------------------------------------------------------------------------------- /item.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import List 3 | 4 | 5 | @dataclass 6 | class Model: 7 | currency: str 8 | item_id: int 9 | model_id: int 10 | promotion_id: int 11 | name: str 12 | price: int 13 | stock: int 14 | 15 | def is_available(self): 16 | return self.stock != 0 17 | 18 | 19 | @dataclass 20 | class UpcomingFlashSaleInfo: 21 | end_time: int 22 | item_id: int 23 | model_ids: list 24 | name: str 25 | price: int 26 | price_before_discount: int 27 | promotion_id: int 28 | shop_id: int 29 | start_time: int 30 | stock: int 31 | 32 | 33 | @dataclass 34 | class AddOnDealInfo: 35 | add_on_deal_id: int = None 36 | add_on_deal_label: str = None 37 | sub_type: int = None 38 | 39 | 40 | @dataclass 41 | class Item: 42 | item_id: int 43 | shop_id: int 44 | models: List[Model] 45 | name: str 46 | price: int 47 | price_before_discount: int 48 | brand: str 49 | shop_location: str 50 | 51 | # prepared for the future (if needed) 52 | upcoming_flash_sale: UpcomingFlashSaleInfo 53 | add_on_deal_info: AddOnDealInfo 54 | price_min: int 55 | price_max: int 56 | stock: int 57 | is_flash_sale: bool 58 | 59 | @staticmethod 60 | def get_price(price) -> int: 61 | return price // 99999 62 | 63 | 64 | @dataclass 65 | class CartItem: 66 | add_on_deal_id: int 67 | item_group_id: str 68 | item_id: int 69 | model_id: int 70 | price: int 71 | shop_id: int 72 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from bot import Bot 2 | from user import User 3 | from checkoutdata import PaymentInfo, PaymentChannel, PaymentChannelOptionInfo 4 | from datetime import datetime 5 | from colorama import Fore, Style, init 6 | from time import sleep 7 | from datetime import datetime 8 | import os 9 | 10 | 11 | init() 12 | INFO = Fore.LIGHTBLUE_EX + "[*]" + Fore.BLUE 13 | INPUT = Fore.LIGHTGREEN_EX + "[?]" + Fore.GREEN 14 | PROMPT = Fore.LIGHTRED_EX + "[!]" + Fore.RED 15 | if os.name.lower() == "nt": 16 | os.system("cls") 17 | else: 18 | os.system("clear") 19 | print(INFO, "Mengambil informasi user...", end='\r') 20 | cookie = open("cookie.txt", 'r') 21 | user = User.login(cookie.read()) 22 | cookie.close() 23 | print(INFO, "Welcome", Fore.GREEN, user.name, ' ' * 10) 24 | print() 25 | 26 | print(INFO, "Masukan url barang yang akan dibeli") 27 | bot = Bot(user) 28 | item = bot.fetch_item_from_url(input(INPUT + " url: " + Fore.RESET)) 29 | 30 | print(Fore.RESET, "-" * 32) 31 | print(Fore.LIGHTBLUE_EX, "Nama:", Fore.GREEN, item.name) 32 | print(Fore.LIGHTBLUE_EX, "Harga:", Fore.GREEN, item.get_price(item.price)) 33 | print(Fore.LIGHTBLUE_EX, "Brand:", Fore.GREEN, item.brand) 34 | print(Fore.LIGHTBLUE_EX, "Lokasi Toko:", Fore.GREEN, item.shop_location) 35 | print(Fore.RESET, "-" * 32) 36 | print() 37 | 38 | selected_model = 0 39 | if len(item.models) > 1: 40 | print(INFO, "Pilih model") 41 | print(Fore.RESET, "-" * 32) 42 | for index, model in enumerate(item.models): 43 | print(Fore.GREEN + '[' + str(index) + ']' + Fore.BLUE, model.name) 44 | print('\t', Fore.LIGHTBLUE_EX, "Harga:", Fore.GREEN, item.get_price(model.price)) 45 | print('\t', Fore.LIGHTBLUE_EX, "Stok:", Fore.GREEN, model.stock) 46 | print('\t', Fore.LIGHTBLUE_EX, "ID Model:", Fore.GREEN, model.model_id) 47 | print(Fore.RESET, "-" * 32) 48 | print() 49 | selected_model = int(input(INPUT + " Pilihan: ")) 50 | print() 51 | 52 | print(INFO, "Pilih metode pembayaran") 53 | payment_channels = dict(enumerate(PaymentChannel)) 54 | for index, channel in payment_channels.items(): 55 | print(Fore.GREEN + '[' + str(index) + ']' + Fore.BLUE, channel.name) 56 | print() 57 | selected_payment_channel = payment_channels[int(input(INPUT + " Pilihan: "))] 58 | print() 59 | 60 | selected_option_info = PaymentChannelOptionInfo.NONE 61 | if selected_payment_channel is PaymentChannel.TRANSFER_BANK or \ 62 | selected_payment_channel is PaymentChannel.AKULAKU: 63 | options_info = dict(enumerate(list(PaymentChannelOptionInfo)[1 if selected_payment_channel is 64 | PaymentChannel.TRANSFER_BANK else 7:None if selected_payment_channel is 65 | PaymentChannel.AKULAKU else 7])) 66 | for index, option_info in options_info.items(): 67 | print(Fore.GREEN + '[' + str(index) + ']' + Fore.BLUE, option_info.name) 68 | print() 69 | selected_option_info = options_info[int(input(INPUT + " Pilihan: "))] 70 | 71 | if not item.is_flash_sale: 72 | if item.upcoming_flash_sale is not None: 73 | flash_sale_start = datetime.fromtimestamp(item.upcoming_flash_sale.start_time) 74 | print(INFO, "Waktu Flash Sale: ", flash_sale_start.strftime("%H:%M:%S")) 75 | print(INFO, "Menunggu Flash Sale...", end='\r') 76 | sleep((datetime.fromtimestamp(item.upcoming_flash_sale.start_time) - datetime.now()).total_seconds()) 77 | else: 78 | print(PROMPT, "Flash Sale telah Lewat!") 79 | exit(1) 80 | print(INFO, "Flash Sale telah tiba") 81 | start = datetime.now() 82 | print(INFO, "Menambah item ke cart...") 83 | cart_item = bot.add_to_cart(item, selected_model) 84 | print(INFO, "Checkout item...") 85 | bot.checkout(PaymentInfo( 86 | channel=selected_payment_channel, 87 | option_info=selected_option_info 88 | ), cart_item) 89 | final = datetime.now() - start 90 | print(INFO, "Item berhasil dibeli dalam waktu", Fore.YELLOW, final.seconds, "detik", final.microseconds // 1000, 91 | "milis") 92 | print(Fore.GREEN + "[*]", "Sukses") 93 | -------------------------------------------------------------------------------- /user.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import Final 3 | import requests 4 | 5 | 6 | @dataclass 7 | class Address: 8 | address: str 9 | city: str 10 | country: str 11 | district: str 12 | formatted_address: str 13 | full_address: str 14 | geo_string: str 15 | id: int 16 | name: str 17 | phone: str 18 | state: str 19 | town: str 20 | zipcode: int 21 | 22 | 23 | @dataclass 24 | class User: 25 | userid: int 26 | shopid: int 27 | name: str 28 | email: str 29 | phone: str 30 | phone_verified: bool 31 | default_address: Address 32 | cookie: str 33 | csrf_token: str 34 | with open("user_agent.txt", 'r') as __user_agent: 35 | USER_AGENT: Final[str] = __user_agent.read() 36 | 37 | @staticmethod 38 | def login(cookie: str): 39 | resp = requests.get( 40 | "https://shopee.co.id/api/v1/account_info", 41 | headers={ 42 | "Accept": "*/*", 43 | "Accept-Encoding": "gzip, deflate, br", 44 | "Referer": "https://shopee.co.id/", 45 | "User-Agent": User.USER_AGENT, 46 | "Cookie": cookie 47 | } 48 | ) 49 | data = resp.json() 50 | if len(data) == 0: 51 | raise Exception("failed to login, invalid cookie") 52 | csrf_token = None 53 | for cookie1 in cookie.split(';'): 54 | key_value = cookie1.split('=') 55 | if key_value[0].strip() == "csrftoken": 56 | csrf_token = key_value[1] 57 | break 58 | return User( 59 | userid=data["userid"], 60 | shopid=data["shopid"], 61 | name=data["username"], 62 | email=data["email"], 63 | phone=data["phone"], 64 | phone_verified=data["phone_verified"], 65 | default_address=Address( 66 | address=data["default_address"]["address"], 67 | city=data["default_address"]["city"], 68 | country=data["default_address"]["country"], 69 | district=data["default_address"]["district"], 70 | formatted_address=data["default_address"]["formattedAddress"], 71 | full_address=data["default_address"]["full_address"], 72 | geo_string=data["default_address"]["geoString"], 73 | id=data["default_address"]["id"], 74 | name=data["default_address"]["name"], 75 | phone=data["default_address"]["phone"], 76 | state=data["default_address"]["state"], 77 | town=data["default_address"]["town"], 78 | zipcode=data["default_address"]["zipcode"] 79 | ), 80 | cookie=cookie, 81 | csrf_token=csrf_token 82 | ) 83 | -------------------------------------------------------------------------------- /user_agent.txt: -------------------------------------------------------------------------------- 1 | Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Mobile Safari/537.36 --------------------------------------------------------------------------------