Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.07 KB | None | 0 0
  1. import requests
  2. import json
  3. import time
  4.  
  5. def send(number,text):
  6.  
  7.     url = "https://eu65.chat-api.com/instance64295/sendFile"
  8.  
  9.     querystring = {"token": "qqt5psc6d9r7kmyn"}
  10.  
  11.     payload = json.dumps({"phone": int(number), "body": "https://s3.amazonaws.com/static.mas57.co/wa.jpeg","filename":"alfredo.jpeg","caption":text})
  12.  
  13.     headers = {
  14.         'Accept': "application/json",
  15.         'Content-Type': "application/json",
  16.         'Origin': "https://app.chat-api.com",
  17.         'Content-Length': "385",
  18.         'Accept-Language': "en-us",
  19.         'Host': "api.chat-api.com",
  20.         'User-Agent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Safari/605.1.15",
  21.         'Referer': "https://app.chat-api.com/docs",
  22.         'Accept-Encoding': "br, gzip, deflate",
  23.         'Connection': "keep-alive",
  24.         'cache-control': "no-cache",
  25.         'Postman-Token': "36c13d52-4eed-469a-8b05-ba61842c3e2f"
  26.     }
  27.  
  28.     response = requests.request("POST", url, data=payload, headers=headers, params=querystring)
  29.  
  30.     print(response.text)
  31.  
  32.  
  33. def sendText(number,text):
  34.     url = "https://eu65.chat-api.com/instance65238/sendMessage"
  35.  
  36.     querystring = {"token": "udl7iu67e3a0iv22"}
  37.  
  38.     payload = json.dumps({"phone": int(number), "body": text})
  39.     headers = {
  40.         'accept': "application/json",
  41.         'Referer': "https://app.chat-api.com/docs",
  42.         'Origin': "https://app.chat-api.com",
  43.         'User-Agent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36",
  44.         'Sec-Fetch-Mode': "cors",
  45.         'content-type': "application/json",
  46.         'Cache-Control': "no-cache",
  47.         'Postman-Token': "0a976d2b-7875-4079-afa7-6dc2a88a4bcb,0cf5a924-d6a1-4480-a221-8f9a04382c29",
  48.         'Host': "api.chat-api.com",
  49.         'Accept-Encoding': "gzip, deflate",
  50.         'Content-Length': "47",
  51.         'Connection': "keep-alive",
  52.         'cache-control': "no-cache"
  53.     }
  54.  
  55.     response = requests.request("GET", url, data=payload, headers=headers, params=querystring)
  56.  
  57.     print(response.text)
  58.  
  59. def sendLink(number,text):
  60.     url = "https://api.chat-api.com/instance64295/sendFile"
  61.  
  62.     querystring = {"token": "qqt5psc6d9r7kmyn"}
  63.  
  64.     payload = json.dumps({"phone": int(number), "body": "https://s3.amazonaws.com/static.mas57.co/dom.jpeg","filename":"alfredo.jpg","caption":text})
  65.  
  66.  
  67.  
  68.     headers = {
  69.         'Accept': "application/json",
  70.         'Content-Type': "application/json",
  71.         'Origin': "https://app.chat-api.com",
  72.         'Content-Length': "385",
  73.         'Accept-Language': "en-us",
  74.         'Host': "api.chat-api.com",
  75.         'User-Agent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Safari/605.1.15",
  76.         'Referer': "https://app.chat-api.com/docs",
  77.         'Accept-Encoding': "br, gzip, deflate",
  78.         'Connection': "keep-alive",
  79.         'cache-control': "no-cache",
  80.         'Postman-Token': "36c13d52-4eed-469a-8b05-ba61842c3e2f"
  81.     }
  82.  
  83.     response = requests.request("POST", url, data=payload, headers=headers, params=querystring)
  84.  
  85.     print(response.text)
  86.  
  87.  
  88. replyMsg = '''
  89. El presidente Uribe regresa a Medellín este 14 de septiembre para acompañar a los candidatos a la Alcaldía de Medellín y a la Gobernación de Antioquia, Alfredo Ramos y Andrés Guerra. Juntos estarán recorriendo la Plaza Minorista (12:00 p.m.), el parque Gaitán en Manrique (3:00p.m.) y el parque Cristo Rey en Guayabal (5:00 p.m.).  Acompáñanos y conoce cómo se generará progreso para Medellín y Antioquia.
  90. '''
  91.  
  92. #sendText("573057865991",replyMsg)
  93. send("573057865991",replyMsg)
  94.  
  95. #sendText("573057865991",replyMsg)
  96. send("573227720766",replyMsg)
  97. #sendText("573227720766",replyMsg)
  98. #exit()
  99. days_file = open("./numbers.txt",'r')
  100. for number in days_file:
  101.     if len(number) > 10:
  102.         time.sleep(1)
  103.         print("57" + str(number))
  104.         send("57" + str(number), replyMsg)
  105.         #sendText("57" + str(number), replyMsg)
  106.  
  107. sendText("573057865991","end")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement