0
import random
from colorama import Fore

file = open("valid.txt", "r+")
codes = file.readlines()


def send():
    headers = {
        "Connection": "Keep-Alive",
        "Keep-Alive": "timeout=100, max=1000"
    }
    params = {
        "cv": "4.6.19178.0323",
        "mn": "304172829",
        "pwd": "492525",
        "source": "client",
        "uname": "gregory"
    }

    url = "https://www3.zoom.us/conf/j"
    try:
        r = requests.post(url, params=params, headers=headers)
        print(Fore.GREEN + "Spammed!")
    except:
        print(Fore.RED + "Nope")


send()

I am trying to keep the request alive, however, every time I attempt to do so it executes without staying alive. How would I go about doing this?

infecting
  • 523
  • 6
  • 10

1 Answers1

1

To take advantage of keep-alive, you'll have to reuse the same session. Otherwise, requests/urllib3 won't be able to automatically keep track of your previous requests.

To do that you should use a requests.Session and reuse it in your request. As explained in the doc, keep-alive will then be automatic.

This answer will show you an example of using requests.Session.

rolf82
  • 1,531
  • 1
  • 5
  • 15
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/30933441) – BrokenBenchmark Jan 30 '22 at 03:56
  • 1
    @BrokenBenchmark: This is clearly a bit more than just a link. I'm not convinced it's a good target for deletion as a link-only answer. – Jeremy Caney Feb 01 '22 at 01:03
  • 1
    I think it's substantially more than "look at these docs", but there are examples which could be extracted into the answer proper. I think a good rule of thumb is "Can this answer stand completely on its own without the links?" and on this question I lean no. – BrokenBenchmark Feb 01 '22 at 01:06