Giter Site home page Giter Site logo

asks's Introduction

Build Status Docs Status

asks

asks is an async requests-like HTTP lib, for use in conjunction with the wonderful curio and trio async libs.

asks aims to have a mostly familiar API, using simple functions/methods like get() for getting and post() for posting. At the heart of asks is a session class which makes interacting with the web in a sustained and fluid way fast, efficient, and simple. Check out the examples!

Check the docs!

http://asks.readthedocs.io/

Above you'll find detailed docs with a large number of simple examples to help you get off the ground in no time.

Installation

Requires: Python 3.6.2 or newer.

pip install asks

Examples

# one request
# A little silly to async one request, but not without its use!
import asks
import anyio

async def example():
    r = await asks.get('https://example.org')
    print(r.content)

curio.run(example())
# many requests
# make 1k api calls and store their response objects
# in a list.

import asks
import trio

path_list = ['http://fakeurl.org/get','http://example123.org']

results = []


async def grabber(s, path):
    r = await s.get(path)
    results.append(r)


async def main(path_list):
    from asks.sessions import Session
    s = Session('https://example.org', connections=2)
    async with trio.open_nursery() as n:
        for path in path_list:
            n.start_soon(grabber, s, path)

trio.run(main, path_list)

Changelog

2.0.0 - Setting stream=True means that the response returned will be a StreamResponse object rather than the default Response object.

Shoutout to ##lp, and the fine peeps of 8banana

asks's People

Contributors

agronholm avatar ahumeau avatar akuli avatar andersea avatar asl2 avatar carlbordum avatar carlwgeorge avatar dahlia avatar ducdetronquito avatar ehaas avatar emtrane avatar fuyukai avatar gwerbin avatar jean avatar jmfrank63 avatar leovp avatar matham avatar millefalcon avatar miracle2k avatar njsmith avatar purplemyst avatar raylu avatar rmstorm avatar rnovatorov avatar scottbelden avatar smurfix avatar tarcisioe avatar theelous3 avatar vincebackpack avatar yifeikong 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.