Giter VIP home page Giter VIP logo

yieldfromrequests_trollius's Introduction

trollius_requests: yieldfrom.Requests (Requests for asyncio) for trollius

Requests is an Apache2 Licensed HTTP library, written in Python, for human beings.

https://github.com/rdbhost/yieldfromRequests yieldfrom.Requests is the same library, ported to run under Python's asyncio.

https://github.com/andrewleech/yieldfromRequests_trollius yieldfrom.Requests (trollius) is yieldfrom.Requests with syntax converted to suit trollius under 2.7 etc.

Where in regular Requests you would write:

>>> r = requests.get('https://api.github.com', auth=('user', 'pass'))
>>> r.status_code
204
>>> r.headers['content-type']
'application/json'
>>> r.text
...
>>> return r.status_code

in yieldfrom.Requests you write:

>>> r = yield From (requests.get('https://api.github.com', auth=('user', 'pass')))
>>> r.status_code
204
>>> r.headers['content-type']
'application/json'
>>> yield From (r.text)
...
>>> raise Return (r.status_code)

The get method and the text property involve I/O latency, hence are called as coroutines. The headers and status_code attributes are still plain attributes.

The feature set is the same as the original, though a few methods work slightly differently.

The .stream() method does not stream, but preloads all data, and simulates a stream, so existing dependencies can work with minimal conversion.

yieldfromrequests_trollius's People

Contributors

lukasa avatar kennethreitz avatar sigmavirus24 avatar slingamn avatar dpursehouse avatar jgorset avatar daftshady avatar jerem avatar gazpachoking avatar idan avatar kmadac avatar schlamar avatar rdbhost avatar kevinburke avatar mjpieters avatar mgiuca avatar monkeython avatar mrtazz avatar acdha avatar davidfischer avatar riyadparvez avatar t-8ch avatar joequery avatar dstufft avatar sharat87 avatar barberj avatar zsiciarz avatar reclosedev avatar atdt avatar kwpolska avatar

Watchers

James Cloos avatar Andrew Leech avatar  avatar

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.