"""{"foo": "bar", "baz": true}""") ) # HTTP POST data only to dictionary response. print( requests.post2json( "http://httpbin.org/post", """{"foo": "bar", "baz": true}""")) # HTTP POST data to JSON response. print( requests.post2json_pretty("http://httpbin.org/post", """{"foo": "bar", "baz": true}""") ) # HTTP POST data to Pretty-Printed JSON response. print( requests.requests( "http://httpbin.org/get", "get", "", [("key", "value")])) # HTTP GET/POST/PUT/DELETE/PATCH,Headers,etc. print(requests.downloads("http://httpbin.org/image/jpeg", "foo.jpeg")) # HTTP GET Download 1 file. print( requests.get2str_list( ["http://httpbin.org/json", "http://httpbin.org/xml"])) # HTTP GET body to string from a list. print( requests.get2ndjson_list( ["http://httpbin.org/json", "http://httpbin.org/json"], "output.ndjson")) # HTTP GET body to NDJSON file from a list.
def test_requests(self): self.assertIsInstance(faster_than_requests.requests("http://httpbin.org/get", "get", "", [("key", "value")]), dict)
import faster_than_requests headers = [ ("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3"), ("Accept-Encoding", "gzip, deflate, br"), ("Accept-Language", "en-US,en;q=0.9"), ("User-Agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36") ] print(faster_than_requests.requests("http://httpbin.org/get", "get", "", headers))