PKqGe 66httpie_zign.py""" STUPS Zign OAuth plugin for HTTPie. """ from httpie.plugins import AuthPlugin import zign.api __version__ = '0.2' __author__ = 'Henning Jacobs' __licence__ = 'Apache 2.0' class InvalidZignToken(Exception): def __init__(self, token_name): self.token_name = token_name def __str__(self): return 'invalid or expired Zign OAuth token: "{}"'.format(self.token_name) class ZignAuth: def __init__(self, token_name, scopes): self.token_name = token_name self.scopes = scopes def __call__(self, r): access_token = zign.api.get_token(self.token_name, self.scopes) if not access_token: raise InvalidZignToken(self.token_name) r.headers['Authorization'] = 'Bearer {}'.format(access_token) return r class ZignPlugin(AuthPlugin): name = 'Zign OAuth 2.0' auth_type = 'zign' description = '' def get_auth(self, username, password): scopes_str = password or '' scopes = list(filter(None, scopes_str.split(','))) return ZignAuth(username, scopes) PKJrGo)httpie_zign-0.2.dist-info/DESCRIPTION.rst=========== httpie-zign =========== STUPS Zign OAuth 2 plugin for the `HTTPie `_ command line HTTP client. `Zign `_ is STUPS' command line client to generate OAuth2 access tokens. Installation ------------ .. code-block:: bash $ pip install httpie-zign You should now see ``zign`` under ``--auth-type`` in ``$ http --help`` output. Usage ----- This plugin takes the Zign token name as the ``--auth`` username. The ``--auth`` password is used to specify to OAuth scopes. A named Zign OAuth 2 token is created and used with the specified scopes: .. code-block:: bash $ http --auth-type=zign --auth=mytok:myscope https://example.org $ http --auth-type=zign -a mytok:myscope1,scope2 https://example.org $ http --auth-type=zign -a mytok: https://example.org # use default scopes You can list the created tokens using the Zign CLI: .. code-block:: bash $ zign li You can set the default ``--auth-type=zign`` option in the ``~/.httpie/config.json`` file for convenience: .. code-block:: bash $ echo '{"default_options": ["--auth-type=zign"]}' > ~/.httpie/config.json $ http -a mytok: https://example.org # that's much shorter now :-) PKJrG]֦???*httpie_zign-0.2.dist-info/entry_points.txt[httpie.plugins.auth.v1] httpie_zign = httpie_zign:ZignPlugin PKJrGe'httpie_zign-0.2.dist-info/metadata.json{"classifiers": ["Development Status :: 5 - Production/Stable", "Programming Language :: Python", "Environment :: Plugins", "License :: OSI Approved :: Apache Software License", "Topic :: Internet :: WWW/HTTP", "Topic :: Utilities"], "extensions": {"python.details": {"contacts": [{"email": "henning.jacobs@zalando.de", "name": "Henning Jacobs", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst"}, "project_urls": {"Home": "https://github.com/zalando-stups/httpie-zign"}}, "python.exports": {"httpie.plugins.auth.v1": {"httpie_zign": "httpie_zign:ZignPlugin"}}}, "extras": [], "generator": "bdist_wheel (0.26.0)", "keywords": ["httpie", "oauth", "oauth2", "stups", "zign", "access", "token"], "license": "Apache License 2.0", "metadata_version": "2.0", "name": "httpie-zign", "run_requires": [{"requires": ["httpie (>=0.7.0)", "stups-zign (>=1.0.17)"]}], "summary": "Zign OAuth 2 plugin for HTTPie.", "version": "0.2"}PKJrGZK\ 'httpie_zign-0.2.dist-info/top_level.txthttpie_zign PKJrG}\\httpie_zign-0.2.dist-info/WHEELWheel-Version: 1.0 Generator: bdist_wheel (0.26.0) Root-Is-Purelib: true Tag: py3-none-any PKJrG(Yzz"httpie_zign-0.2.dist-info/METADATAMetadata-Version: 2.0 Name: httpie-zign Version: 0.2 Summary: Zign OAuth 2 plugin for HTTPie. Home-page: https://github.com/zalando-stups/httpie-zign Author: Henning Jacobs Author-email: henning.jacobs@zalando.de License: Apache License 2.0 Keywords: httpie oauth oauth2 stups zign access token Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Programming Language :: Python Classifier: Environment :: Plugins Classifier: License :: OSI Approved :: Apache Software License Classifier: Topic :: Internet :: WWW/HTTP Classifier: Topic :: Utilities Requires-Dist: httpie (>=0.7.0) Requires-Dist: stups-zign (>=1.0.17) =========== httpie-zign =========== STUPS Zign OAuth 2 plugin for the `HTTPie `_ command line HTTP client. `Zign `_ is STUPS' command line client to generate OAuth2 access tokens. Installation ------------ .. code-block:: bash $ pip install httpie-zign You should now see ``zign`` under ``--auth-type`` in ``$ http --help`` output. Usage ----- This plugin takes the Zign token name as the ``--auth`` username. The ``--auth`` password is used to specify to OAuth scopes. A named Zign OAuth 2 token is created and used with the specified scopes: .. code-block:: bash $ http --auth-type=zign --auth=mytok:myscope https://example.org $ http --auth-type=zign -a mytok:myscope1,scope2 https://example.org $ http --auth-type=zign -a mytok: https://example.org # use default scopes You can list the created tokens using the Zign CLI: .. code-block:: bash $ zign li You can set the default ``--auth-type=zign`` option in the ``~/.httpie/config.json`` file for convenience: .. code-block:: bash $ echo '{"default_options": ["--auth-type=zign"]}' > ~/.httpie/config.json $ http -a mytok: https://example.org # that's much shorter now :-) PKJrGbգ httpie_zign-0.2.dist-info/RECORDhttpie_zign.py,sha256=M7OrhA9qP4_SQQnLTkgy5cjItqhPQB7Yo3v_Z6m7eiE,1078 httpie_zign-0.2.dist-info/DESCRIPTION.rst,sha256=pcDztTUJYBJXCgtQ1uztt047dxESFHhpFW2oAtFThxc,1261 httpie_zign-0.2.dist-info/METADATA,sha256=0VvubZf_JX4vpGCP9ApP0CDlY7_QMLkhbXgTZaQgCt0,1914 httpie_zign-0.2.dist-info/RECORD,, httpie_zign-0.2.dist-info/WHEEL,sha256=zX7PHtH_7K-lEzyK75et0UBa3Bj8egCBMXe1M4gc6SU,92 httpie_zign-0.2.dist-info/entry_points.txt,sha256=MA-Sl4cjJ_69cfIdpJV_ri7b4LKMPu8TK8k7TrBulV8,63 httpie_zign-0.2.dist-info/metadata.json,sha256=hmYzjTC913NgZ0YAbNQgiVB0stpB0jP0kUFTqFzg7Hw,940 httpie_zign-0.2.dist-info/top_level.txt,sha256=xpeAMzKjBYGsJuyIpmzzaI4vuu1F7mMQuFrvwIwCAA0,12 PKqGe 66httpie_zign.pyPKJrGo)bhttpie_zign-0.2.dist-info/DESCRIPTION.rstPKJrG]֦???* httpie_zign-0.2.dist-info/entry_points.txtPKJrGe' httpie_zign-0.2.dist-info/metadata.jsonPKJrGZK\ 'httpie_zign-0.2.dist-info/top_level.txtPKJrG}\\_httpie_zign-0.2.dist-info/WHEELPKJrG(Yzz"httpie_zign-0.2.dist-info/METADATAPKJrGbգ httpie_zign-0.2.dist-info/RECORDPK