All Projects → Lispython → Human_curl

Lispython / Human_curl

Licence: other
Simple Human wrapper for cURL library

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Human curl

Php Curl Class
PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs
Stars: ✭ 2,903 (+1309.22%)
Mutual labels:  curl, requests
curlall
Simple curl-like CLI tool to automatically page through APIs
Stars: ✭ 25 (-87.86%)
Mutual labels:  curl, requests
Curl
Custom PHP curl library for the Laravel 5 framework - developed by Ixudra
Stars: ✭ 537 (+160.68%)
Mutual labels:  curl, requests
curly.hpp
Simple cURL C++17 wrapper
Stars: ✭ 48 (-76.7%)
Mutual labels:  curl, requests
Requester
Powerful, modern HTTP/REST client built on top of the Requests library
Stars: ✭ 273 (+32.52%)
Mutual labels:  curl, requests
Guzzle
Guzzle, an extensible PHP HTTP client
Stars: ✭ 21,384 (+10280.58%)
Mutual labels:  curl, requests
Libhv
🔥 比libevent、libuv更易用的国产网络库。A c/c++ network library for developing TCP/UDP/SSL/HTTP/WebSocket client/server.
Stars: ✭ 3,355 (+1528.64%)
Mutual labels:  requests, curl
Torrequest
Simple Python interface for HTTP(s) requests over Tor
Stars: ✭ 175 (-15.05%)
Mutual labels:  requests
Yurunhttp
YurunHttp 是开源的 PHP HTTP 客户端,支持链式操作,简单易用。完美支持Curl、Swoole 协程。QQ群:17916227
Stars: ✭ 197 (-4.37%)
Mutual labels:  curl
J2team Community
Join our group to see more
Stars: ✭ 172 (-16.5%)
Mutual labels:  curl
Webcc
Lightweight C++ HTTP client and server library based on Asio for embedding purpose.
Stars: ✭ 167 (-18.93%)
Mutual labels:  requests
Php Whois
PHP WHOIS provides parsed and raw whois lookup of domains and ASN routes. PHP 5.4+ and 7+ compatible
Stars: ✭ 179 (-13.11%)
Mutual labels:  curl
Lua Curlv3
Lua binding to libcurl
Stars: ✭ 197 (-4.37%)
Mutual labels:  curl
Zebra curl
A high performance cURL PHP library for running of multiple requests at once, asynchronously
Stars: ✭ 172 (-16.5%)
Mutual labels:  curl
Curl To Ruby
⬇️ Convert a curl command into ruby's net/http
Stars: ✭ 202 (-1.94%)
Mutual labels:  curl
Curlx
◼️ Supercharge curl with history, collections and more.
Stars: ✭ 169 (-17.96%)
Mutual labels:  curl
Transistor
Transistor, a Python web scraping framework for intelligent use cases.
Stars: ✭ 205 (-0.49%)
Mutual labels:  requests
Googliser
a fast BASH multiple-image downloader
Stars: ✭ 202 (-1.94%)
Mutual labels:  curl
Google Group Crawler
Get (almost) original messages from google group archives. Your data is yours.
Stars: ✭ 190 (-7.77%)
Mutual labels:  curl
Github.vim
Another github v3 api implemented in vim script
Stars: ✭ 187 (-9.22%)
Mutual labels:  curl

Welcome to human_curl's documentation!

Curl requests for Humans

human_curl allow you to send HEAD, GET, POST, PUT, OPTIONS, and DELETE HTTP requests.

.. image:: https://secure.travis-ci.org/Lispython/human_curl.png :target: https://secure.travis-ci.org/Lispython/human_curl

Features

  • Custom HTTP headers
  • Request data/params
  • Multiple file uploading
  • Async requests!
  • Cookies support (dict or CookieJar)
  • Redirection history
  • Proxy support (http, https, socks4/5)
  • Custom interface for request!
  • Auto decompression of GZipped content
  • Unicode URL support
  • Request timers and another info
  • Certificate validation
  • ipv6 support
  • Basic/Digest authentication
  • OAuth support!
  • Debug request and response headers
  • .netrc support

Usage

Simple get request

>>> import human_curl as requests # python-requests.org compatibile
>>> # import human_curl as hurl # unfortunately hurl.it keeps this name :-)
>>> r = hurl.get('http://h.wrttn.me/basic-auth/test_username/test_password',
... auth=('test_username', 'test_password'))
>>> r.status_code
200
>>> r.content
'{"username": "test_username", "password": "test_password", "authenticated": true}'

Cookies and headers

>>> import human_curl as hurl # python-requests.org compatibile
>>> r = hurl.get("http://h.wrttn.me/cookies/set/ajfwjlknefjrrf/fkjwnfklrnjge")
>>> r.cookies
    {'ajfwjlknefjrrf': 'fkjwnfklrnjge'}
>>> r.headers['etag']
    bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f
>>> r.headers
    {'connection': 'keep-alive',
     'content-length': '2',
     'content-type': 'text/html; charset=UTF-8',
     'date': 'Mon, 05 Sep 2011 20:28:47 GMT',
     'etag': 'bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f',
     'server': 'LightBeer/0.568'}

Send files and variables

>>> import human_curl as hurl
>>> r = hurl.post('http://h.wrttn.me/post', files=(('file_1', '/tmp/testfile1.txt'),
... ('file2', open('/tmp/testfile2.txt'))), data={'var_name': 'var_value'})
>>> r.status_code
201

Redirects

>>> import human_curl as hurl
>>> r = hurl.get('http://h.wrttn.me/redirect/4', allow_redirects=True)
>>> r.status_code
200
>>> print(r.history)
['http://h.wrttn.me/redirect/3', 'http://h.wrttn.me/redirect/2',
 'http://h.wrttn.me/redirect/1', 'http://h.wrttn.me/redirect/end']
>>> print(r.url)
http://h.wrttn.me/redirect/end

Auth managers

>>> import human_curl as hurl
>>> from human_curl.auth import BasicAuth, DigestAuth
>>> auth_manager = DigesAuth('username', 'password')
>>> r = hurl.post('http://h.wrttn.me/digest-auth/auth/username/password',
... auth=auth_manager)
>>> r.status_code
200
>>> basic_auth_manager = BasicAuth('username', 'password')
>>> r = hurl.post('http://h.wrttn.me/basic-auth/username/password',
... auth=basic_auth_manager)
>>> r.status_code
200
>>> oauth_manager = OAuthManager((CONSUMER_KEY, CONSUMER_SECRET), (TOKEN_KEY, TOKEN_SECRET))
>>> r = hurl.get('http://oauth-protected.com/resource', auth=oauth_manager)
>>> r.status_code
200

Debug requests

>>> import human_curl as hurl
>>> # stdout_debug(debug_type, debug_msg)
>>> r = hurl.get("https://h.wrttn.me/basic-auth/username/password",
... debug=stdout_debug, allow_redirects=False,
... auth=("username", "password"))
>>> print(r.status_code)
200

Async requests

>>> from human_curl.async import AsyncClient
>>> async_client = AsyncClient(success_callback=lambda **kw: print kw,
... fail_callback=lambda **kw: print kw)
>>> async_client.get('http://h.wrttn.me/get')
>>> async_client.get('http://httpbin.org/get',
... success_callback=lambda **kw: print("success!"),
... fail_callback=lambda **kw: print("fail!")
>>> async_client.start()

TODO

  • curl command generation?

INSTALLATION

To use human_curl use pip or easy_install:

pip install human_curl

or

easy_install human_curl

CONTRIBUTE

Fork https://github.com/Lispython/human_curl/ , create commit and pull request to develop.

SEE ALSO

If you don't like cURL (why?), try to use python-requests_.

.. _python-requests: http://python-requests.org

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].