This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

DEPRECATION WARNING

Warning

There is a much better lib than this one for the job: txrequests .

You are now invited to use this instead.

If I have any improvements to make, I’ll make them to txrequests and not here.

Twisted adapter for the requests library

Tiny add-on for the requests HTTP library so it can be used transparently with Twisted by deferring blocking calls to threads.

It just wraps all requests in deferToThread, really.

Usage:

# To use requests with Twisted, you just need to use
# a our requests.Session subclass manually.
# See http://docs.python-requests.org/en/latest/user/advanced/
# for some informations about the Session class.
from requests_twisted import TwistedRequestsSession
session = TwistedRequestsSession()

# Then after, instead of doing requests.get|post|whatever(), you just do
# session.get|post|whatever().
# It returns a defer :
defer = session.get('http://github.com/sametmax/')
def print_status(response):
    print(response.url, response.status_code)

# Which you just handle as you would usually do.
defer.addCallback(print_status)

There are no changes to the request API, the only difference is the defer.

If you are doing a lot of requests, remember you can change the reactor thread pool by doing :

from twisted.internet import reactor
reactor.suggestThreadPoolSize(number_of_threads)

The default size of the thread pool depends on the reactor being used; the default reactor uses a minimum size of 5 and a maximum size of 10. Be careful that you understand threads and their resource usage before drastically altering the thread pool sizes.

Installation

pip install requests-twisted

Informations

Supports : Python 2.7 (maybe 2.6, I didn’t test it) Licence : Zlib

Release History

Release History

0.1.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
requests-twisted-0.1.2.tar.gz (3.3 kB) Copy SHA256 Checksum SHA256 Source Feb 4, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting