Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Async requests-like httplib for python.

License

NotificationsYou must be signed in to change notification settings

theelous3/asks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build StatusDocs Status

asks

asks is an asyncrequests-like HTTP lib, for use in conjunction with the wonderfulcurio andtrio async libs.

asks aims to have a mostly familiar API, using simple functions/methods likeget() for getting andpost() for posting.At the heart ofasks 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!importasksimportanyioasyncdefexample():r=awaitasks.get('https://example.org')print(r.content)anyio.run(example)
# many requests# make 1k api calls and store their response objects# in a list.importasksimporttriopath_list= ['http://fakeurl.org/get','http://example123.org']results= []asyncdefgrabber(s,path):r=awaits.get(path)results.append(r)asyncdefmain(path_list):fromasks.sessionsimportSessions=Session('https://example.org',connections=2)asyncwithtrio.open_nursery()asn:forpathinpath_list:n.start_soon(grabber,s,path)trio.run(main,path_list)

Changelog

2.0.0 - Settingstream=True means that the response returned will be aStreamResponse object rather than the defaultResponse object.

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

[8]ページ先頭

©2009-2025 Movatter.jp