aakash2310

Untitled

Apr 27th, 2024
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.71 KB | None | 0 0
  1. import requests
  2. import random_address
  3. import json
  4. import random
  5. import getindianname as name
  6.  
  7. proxies = {
  8. #proxy here
  9. }
  10.  
  11. while True:
  12. add = random_address.real_random_address_by_state('CA')
  13. add = add['address1']
  14. # print(add)
  15. fname = name.randname()
  16. print(fname)
  17. def generate_random_number(size):
  18. start = 10 ** size
  19. end = 10 ** (size + 1) - 1
  20. return random.randint(start, end)
  21.  
  22.  
  23.  
  24. random_numbers = generate_random_number(9)
  25. # print(random_numbers)
  26.  
  27.  
  28. random_numbers2 = generate_random_number(29)
  29.  
  30. random_numbers3 = generate_random_number(5)
  31. # print(random_numbers2)
  32.  
  33. states = [
  34. "Andhra Pradesh", "Arunachal Pradesh", "Assam", "Bihar", "Chhattisgarh",
  35. "Goa", "Gujarat", "Haryana", "Himachal Pradesh", "Jharkhand",
  36. "Karnataka", "Kerala", "Madhya Pradesh", "Maharashtra", "Manipur",
  37. "Meghalaya", "Mizoram", "Nagaland", "Odisha", "Punjab", "Rajasthan",
  38. "Sikkim", "Tamil Nadu", "Telangana", "Tripura", "Uttar Pradesh",
  39. "Uttarakhand", "West Bengal"
  40. ]
  41.  
  42. selected_state = random.choice(states)
  43.  
  44. headers = {
  45. 'accept': 'application/json, text/plain, */*',
  46. 'accept-language': 'en-US,en;q=0.9',
  47. 'content-type': 'text/plain',
  48. 'origin': 'https://covercase.in',
  49. 'priority': 'u=1, i',
  50. 'referer': 'https://covercase.in/',
  51. 'sec-ch-ua': '"Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"',
  52. 'sec-ch-ua-mobile': '?0',
  53. 'sec-ch-ua-platform': '"Windows"',
  54. 'sec-fetch-dest': 'empty',
  55. 'sec-fetch-mode': 'cors',
  56. 'sec-fetch-site': 'cross-site',
  57. 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36',
  58. }
  59.  
  60. data = f'''
  61. {{
  62. "hash": "{random_numbers2}",
  63. "shop": "4e5e46-3.myshopify.com",
  64. "currency": {{
  65. "active": "INR",
  66. "rate": "1.0"
  67. }},
  68. "data": {{
  69. "first_name": {{
  70. "title": "First Name",
  71. "value": "Aakash"
  72. }},
  73. "last_name": {{
  74. "title": "Last Name",
  75. "value": "Shah"
  76. }},
  77. "phone": {{
  78. "title": "Phone",
  79. "value": "{random_numbers}"
  80. }},
  81. "address": {{
  82. "title": "Address",
  83. "value": "{add}"
  84. }},
  85. "address2": {{
  86. "title": "Landmark",
  87. "value": "X"
  88. }},
  89. "zip": {{
  90. "title": "PIN code",
  91. "value": "{random_numbers3}"
  92. }},
  93. "city": {{
  94. "title": "City",
  95. "value": "X"
  96. }},
  97. "province": {{
  98. "title": "State",
  99. "value": "{selected_state}"
  100. }},
  101. "buyer_accepts_marketing": {{
  102. "title": null,
  103. "value": []
  104. }},
  105. "country": {{
  106. "value": "IN"
  107. }}
  108. }},
  109. "cart": [
  110. {{
  111. "handle": "metal-frame-ultra-thin-clear-i-phone-case-cover",
  112. "product_type": "",
  113. "product_id": 7502604468364,
  114. "title": "Metal Frame Ultra-thin Clear I-Phone Case/Cover ( Buy 1 Get 1 Free )",
  115. "vendor": "Covercase.in",
  116. "url": "/products/metal-frame-ultra-thin-clear-i-phone-case-cover?variant=42116230545548",
  117. "image": "https://cdn.shopify.com/s/files/1/0637/3480/8716/files/8f5bc098-9a56-4b03-9f9b-8b9512b88457_jpg.webp?v=1707072851",
  118. "quantity": 1,
  119. "variant_id": 42116230545548,
  120. "variant_title": "I-Phone 11",
  121. "price": 699,
  122. "original_price": 699,
  123. "line_price": 699,
  124. "original_line_price": 699,
  125. "weight": 0,
  126. "properties": {{}}
  127. }}
  128. ],
  129. "shipping": null,
  130. "locale": "en",
  131. "version": "94",
  132. "source_url": "https://covercase.in/products/metal-frame-ultra-thin-clear-i-phone-case-cover",
  133. "offer": null,
  134. "downsell": {{
  135. "discount_amount": 0
  136. }},
  137. "recovered": false,
  138. "is_draft_order": false,
  139. "verified": false,
  140. "utms": {{}},
  141. "pixelCookies": {{
  142. "fbp": "",
  143. "fbc": ""
  144. }}
  145. }}
  146. '''
  147.  
  148.  
  149. response = requests.post('https://load.tyslo.com/order/new', headers=headers, data=data,proxies=proxies)
  150.  
  151. # print(response.text)
  152. y = json.loads(response.text)
  153.  
  154. if y['success']:
  155. print("SUCCESS:")
  156. ono = y['data']['order']['order_number']
  157. print('Order Number : ',ono,end=' ')
  158. st = y['data']['order']['billing_address']['province']
  159. print('State : ',st,end=' ')
  160.  
  161. with open("order.txt", "a") as file:
  162. file.write("\n")
  163. file.write(f'Order Number : {ono} ')
  164. file.write(f'State : {st} ')
Advertisement
Add Comment
Please, Sign In to add comment