├── httpie_oauth.py
├── README.rst
├── setup.py
└── LICENSE
/httpie_oauth.py:
--------------------------------------------------------------------------------
1 | """
2 | OAuth plugin for HTTPie.
3 |
4 | """
5 | from httpie.plugins import AuthPlugin
6 | from requests_oauthlib import OAuth1
7 |
8 |
9 | __version__ = '1.0.2'
10 | __author__ = 'Jakub Roztocil'
11 | __licence__ = 'BSD'
12 |
13 |
14 | class OAuth1Plugin(AuthPlugin):
15 |
16 | name = 'OAuth 1.0a 2-legged'
17 | auth_type = 'oauth1'
18 | description = ''
19 |
20 | def get_auth(self, username, password):
21 | return OAuth1(client_key=username, client_secret=password)
22 |
--------------------------------------------------------------------------------
/README.rst:
--------------------------------------------------------------------------------
1 |
2 | ℹ️ Please use the newer `httpie-oauth1` plugin instead:
3 |
4 | https://github.com/qcif/httpie-oauth1
5 |
6 | ------
7 |
8 |
9 | httpie-oauth
10 | ===========
11 |
12 | OAuth plugin for `HTTPie `_.
13 |
14 | It currently provides support for OAuth 1.0a 2-legged.
15 |
16 |
17 | Installation
18 | ------------
19 |
20 | .. code-block:: bash
21 |
22 | $ pip install httpie-oauth
23 |
24 |
25 | You should now see ``oauth1`` under ``--auth-type`` in ``$ http --help`` output.
26 |
27 |
28 | Usage
29 | -----
30 |
31 | .. code-block:: bash
32 |
33 | $ http --auth-type=oauth1 --auth='client-key:client-secret' example.org
34 |
35 |
36 | You can also use `HTTPie sessions `_:
37 |
38 | .. code-block:: bash
39 |
40 | # Create session
41 | $ http --session=logged-in --auth-type=oauth1 --auth='client-key:client-secret' example.org
42 |
43 | # Re-use auth
44 | $ http --session=logged-in POST example.org hello=world
45 |
46 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | from setuptools import setup
2 | try:
3 | import multiprocessing
4 | except ImportError:
5 | pass
6 |
7 |
8 | setup(
9 | name='httpie-oauth',
10 | description='OAuth plugin for HTTPie.',
11 | long_description=open('README.rst').read().strip(),
12 | version='1.0.2',
13 | author='Jakub Roztocil',
14 | author_email='jakub@roztocil.name',
15 | license='BSD',
16 | url='https://github.com/jkbr/httpie-oauth',
17 | download_url='https://github.com/jkbr/httpie-oauth',
18 | py_modules=['httpie_oauth'],
19 | zip_safe=False,
20 | entry_points={
21 | 'httpie.plugins.auth.v1': [
22 | 'httpie_oauth1 = httpie_oauth:OAuth1Plugin'
23 | ]
24 | },
25 | install_requires=[
26 | 'httpie>=0.7.0',
27 | 'requests-oauthlib>=0.3.2'
28 | ],
29 | classifiers=[
30 | 'Development Status :: 5 - Production/Stable',
31 | 'Programming Language :: Python',
32 | 'Environment :: Plugins',
33 | 'License :: OSI Approved :: BSD License',
34 | 'Topic :: Internet :: WWW/HTTP',
35 | 'Topic :: Utilities'
36 | ],
37 | )
38 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright © 2013 Jakub Roztocil
2 |
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions are met:
5 |
6 | 1. Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 |
9 | 2. Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 |
13 | 3. Neither the name of The author nor the names of its contributors may
14 | be used to endorse or promote products derived from this software
15 | without specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE FOR
21 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 |
--------------------------------------------------------------------------------