How to use the gevent.monkey function in gevent

To help you get started, we’ve selected a few gevent examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sendwithus / vic-startup-jobs / link_checker / check.py View on Github external
from gevent import monkey
monkey.patch_all()

import itertools
import random
import re
import sys
import traceback
import warnings

import gevent
from gevent.pool import Pool
import requests
from urllib3.exceptions import InsecureRequestWarning

warnings.filterwarnings("ignore", category=InsecureRequestWarning)

markdown_file = 'README.md'
github byt3bl33d3r / CrackMapExec / cme / __init__.py View on Github external
from gevent import monkey
import sys
import os
import cme

monkey.patch_all()

thirdparty_modules = os.path.join(os.path.dirname(cme.__file__), 'thirdparty')

for module in os.listdir(thirdparty_modules):
    sys.path.insert(0, os.path.join(thirdparty_modules, module))
github smetj / wishbone / wishbone / module / stdout.py View on Github external
#  the Free Software Foundation; either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#  MA 02110-1301, USA.
#
#

from gevent import monkey; monkey.patch_all()
from wishbone.module import OutputModule
from os import getpid
from colorama import init, Fore, Back, Style
import sys
import re
from gevent.fileobject import FileObjectThread


class Format():

    def __init__(self, selection, counter, pid):
        self.selection = selection
        if counter:
            self.counter = self.__returnCounter
        else:
            self.counter = self.__returnNoCounter
github coffeehb / tools / pdns_sniff / pdns_sniff.py View on Github external
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 17/2/5 上午9:59
# @Author  : Komi
# @File    : pdns_sniff.py
# @Ver:    : 0.1

from gevent import monkey;monkey.patch_all()
import gevent
from scapy.all import sr1, IP, UDP, DNS, DNSQR, DNSRR
from scapy.all import sniff
import datetime
import argparse
import MySQLdb as mysql
import Queue
import time
import traceback

dnslogsQueueList = Queue.Queue()
hook_domains = ['baidu.com']

def save_mysql():
    print "[+] Start Saving......"
    global dnslogsQueueList
github dimagi / commcare-hq / scripts / prime_views.py View on Github external
'registration/requests_by_username',
        'reminders/by_domain_handler_case',
        'sms/verified_number_by_suffix',
        'translations/popularity',
        'users/admins_by_domain',
    ]

    def do_prime(view_name):
        print "priming %s" % view_name
        try:
            db = XFormInstance.get_db()
            db.view(view_name, limit=2).all()
        except:
            print "Got an exception but ignoring"

    from gevent import monkey; monkey.patch_all(thread=False)
    from gevent.pool import Pool
    import time
    pool = Pool(12)
    while True:
        for view in views:
            g = pool.spawn(do_prime, view)
        pool.join()
        print "Finished priming views, waiting 30 seconds"
        time.sleep(30)

    print "done!"
github mushorg / buttinsky / buttinsky.py View on Github external
#!/usr/bin/env python
# Copyright (C) 2012 Buttinsky Developers.
# See 'COPYING' for copying permission.

import os
import sys

from configobj import ConfigObj

import gevent.monkey
gevent.monkey.patch_all()

from SimpleXMLRPCServer import SimpleXMLRPCServer

from modules.reporting import hpfeeds_logger

from spawner import MonitorSpawner, ButtinskyXMLRPCServer
import cli

import gevent
from gevent import queue

import logging
import logging.config

logging.config.fileConfig('conf/logging.ini')
logger = logging.getLogger(__name__)
github ceph / calamari / webapp / calamari / manage.py View on Github external
#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
    # Load gevent so that runserver will behave itself when zeroRPC is used
    from gevent import monkey
    monkey.patch_all()

    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "calamari_web.settings")

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)
github synnack / videoconference / gevent-websocket.py View on Github external
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see .
"""

from gevent import monkey
monkey.patch_all()
from videoconference.wsgi import application
import simplejson as json

from gevent import pywsgi
from geventwebsocket.handler import WebSocketHandler

from websockets.websockethandler import Handler
from websockets.sockets import WebSockets
from scheduler.models import MCU, Reservation


from django.contrib.sessions.backends.db import SessionStore
from django.contrib.auth.models import User
from importlib import import_module
from django.http import parse_cookie
from django.contrib.sessions.models import Session
github dropbox / changes / changes / runner.py View on Github external
def patch_gevent():
    from gevent import monkey
    monkey.patch_all()

    from changes.db import psyco_gevent
    psyco_gevent.make_psycopg_green()
github closeio / closeio-api-scripts / scripts / bulk_download_call_recordings.py View on Github external
import argparse
import base64
import csv
from datetime import datetime
from operator import itemgetter

import gevent.monkey
gevent.monkey.patch_all()
import requests
from closeio_api import Client as CloseIO_API
from dateutil.relativedelta import relativedelta
from gevent.pool import Pool

parser = argparse.ArgumentParser(description='Bulk Download Close.io Call Recordings into a specified Folder')
parser.add_argument('--api-key', '-k', required=True, help='API Key')
parser.add_argument('--date_start', '-s', required=True, help='The start of the date range you want to download recordings for in yyyy-mm-dd format.')
parser.add_argument('--date_end', '-e', required=True, help='The end of the date range you want to download recordings for in yyyy-mm-dd format.')
parser.add_argument('--file-path', '-f', required=True, help='The file path to the folder where the recordings will be stored.')
args = parser.parse_args()

api = CloseIO_API(args.api_key)
org_id = api.get(f'api_key/{args.api_key}', params={'_fields': 'organization_id'})['organization_id']
org_name = api.get('organization/' + org_id, params={'_fields': 'name'})['name'].replace('/', '')
days = []