Lispython / human_curl

Simple Human wrapper for cURL library
http://h.wrttn.me/human_curl
Other
205 stars 43 forks source link

Context managers #4

Open Lispython opened 13 years ago

Lispython commented 13 years ago

Need add context manager to store session on one closure/namespace with sharing data between mathods calls

Example

 with human_curl as hurl:
     r1 = hurl.get("http://google.com")
     r2 = hurl.get("http://yandex.com")

or

 headers = dict(...)
 with human_curl(proxy=("127.0.0.1",8080), headers=headers) as hurl:
     # all human_curl arguments give into methods
     r1 = hurl.get("http://google.com")
     r2 = hurl.get("http://yandex.com")
honzajavorek commented 11 years ago

This could mimick requests.Session.