Git Product home page Git Product logo

greenreactor's Introduction

Greenreactor

A reactor which make twisted compatc with gevent

Motivation

Originally I wrote code for Scrapy. I want to combine gevent in Scrapy, so I created this greenreactor.

Installation

pip install greenreactor

Usage

# Usually we need monkey patch, simply patch all things or patch part of them if you understand what you are doing.
# Guideline: http://www.gevent.org/api/gevent.monkey.html
import gevent.monkey
# Disable some patch properly, for example: DISABLE THREAD PATCH ---- gevent.monkey.patch_all(thread=False)
gevent.monkey.patch_all()


# Install greenreactor
import greenreactor
greenreactor.install()

from twisted.internet import reactor
reactor.run()

Thats all! Now you can use any gevent api such as spawn, spawn_later, etc.

greenreactor's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

mksh

greenreactor's Issues

6啊大兄弟

我是刚来eigen做爬虫的,顺便维护下dcrawl的框架。。。大量小item上传oss速度有问题,想找个twisted的gevent reactor,一搜居然找到老哥你了,为啥内部git上找不到啊。。。

简单测了下没啥问题,但我也不懂twisted,想问下这个有啥坑吗

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.