summaryrefslogtreecommitdiff
path: root/keystoneclient/client.py
Commit message (Collapse)AuthorAgeFilesLines
* Docstring: Mark optional parameter as optional.Rushi Agrawal2015-12-161-1/+1
| | | | | | | In client.Client, providing version number is optional. So write '(optional)' in the docstring describing this parameter. Change-Id: I5e355515de8d043bda85b5abf43c549b4ba22d61
* Proper deprecation for Session.construct()Brant Knudson2015-08-131-1/+1
| | | | | | | | | | Session.construct() wasn't properly deprecated since the deprecation was only mentioned in the docstring. Proper deprecation requires use of warnings/debtcollector and documentation. bp deprecations Change-Id: Ieff238aff9d39cfbbb80381b2392c33d0359acb3
* Proper deprecation for client.HTTPClientBrant Knudson2015-07-261-2/+12
| | | | | | | | | | client.HTTPClient wasn't properly deprecated since all it had was a comment in the code. Proper deprecation requires use of warnings and documentation. bp deprecations Change-Id: I1c50c1441b23a79831e6e1df749084130e4b9af7
* Docstring usability improvementsBrant Knudson2015-01-071-8/+13
| | | | | | | | | | The generated docs didn't provide enough information for a developer to get started using the API. This change enhances the documentation for the module so that a developer knows where to go to start (create a Client). Partial-Bug: #1330769 Change-Id: I907187d34ebf2c2e662ff7b9547b0ecaef008414
* Cleanup docs - raises classBrant Knudson2014-10-181-2/+4
| | | | | | | | | The argument to the :raises: directive is the class name. If the class name is a valid reference it's rendered as a link to the class. This change cleans up the :raises: directives to use the reference correctly and use a valid class reference. Change-Id: I84188b60de0ab4c6b5b2fb5a203c43bfde094707
* Remove vim headerEric Guo2014-02-081-2/+0
| | | | | | | | We don't need vim modelines in each source file, it can be set in user's vimrc. Change-Id: Ic7a61430a0a320ce6b0c4518d9f5d988e35f8aae Closes-Bug: #1229324
* Provide a conversion function for creating sessionJamie Lennox2014-02-031-3/+9
| | | | | | | | | | | | | | Session.construct will create a session based upon the kwargs that used to be passed to a client __init__ function. This will allow clients an easy path to providing compatibility with deprecated arguments. Make use of the function throughout discovery. Discovery was initially released prior to the session object being completed and was therefore handled with the same arguments as a client. Instead we should use a session object so use the conversion function to convert those kwargs into a session object if one is not provided. Change-Id: I8dc1e0810ea6ebc6ea648ec37d7881825c566676
* Adjust import items according to hacking import ruleEric Guo2014-01-171-0/+1
| | | | | | | | | | | | | | | | | | This patch adjust import items and add missing blank lines acording to http://docs.openstack.org/developer/hacking/#imports {{stdlib imports in human alphabetical order}} \n {{third-party lib imports in human alphabetical order}} \n {{project imports in human alphabetical order}} \n \n {{begin your code}} hacking project also enforce some checks for import group. Let make the change in keytoneclient Change-Id: Ic83bd5ee426905588f4a2d555851a9a01fc69f02
* Discover supported APIsJamie Lennox2013-12-031-0/+23
| | | | | | | | Allow discovery of the API versions a server supports and create an appropriate client based on this. Implements: blueprint api-version-discovery Change-Id: I63e6759889066a784dc47e35152c82e1ead7951d
* Restore client.py for backward compatibilityJamie Lennox2013-08-211-0/+18
| | | | | | | | | Simply pull in HTTPClient from its new location. This also restores the tests that were modified back to there original form to make sure nothing has changed from the original. Fixes: bug 1211998 Change-Id: Ia3241a4352eb6b37c6489cd4dd1bc373de107e12
* Rename client.py to httpclient.pyJamie Lennox2013-08-101-623/+0
| | | | | | | | | | | | | The discoverable entry point is to be client.Client however adding this functionality to the current client.py is impossible as we end up with circular dependencies. This patch simply renames the current client.py to httpclient.py to make future patches that will modify client.py more readable. Required for: blueprint api-version-discovery Change-Id: Ibcea03f6e1df0ae05329297166a8b8117fc3ce7b
* Client V3 shouldn't inherit V2Jamie Lennox2013-07-231-1/+22
| | | | | | | | Client V3 is a completely different implementation of the API, if we want to intermix the V2 and V3 APIs then we don't need to version our client at all. Change-Id: I80579cd41df73ccfc6c8feb76843772829afac4e
* Implements v3 auth client.lin-hua-cheng2013-06-201-62/+231
| | | | | | | | | | | Added support for domain scoping. Enhancement on AccessInfo to support reading v2/v3 token information. Enhancement on ServiceCatalog for reading/filtering v2/v3 service catalog information. Change-Id: Ibb678b9933d3673e37d0fba857a152a3c5d2b4f4
* Merge "Use AuthRef for some client fields"Jenkins2013-06-151-0/+9
|\
| * Use AuthRef for some client fieldsJulien Danjou2013-06-111-0/+9
| | | | | | | | | | | | | | This tackles some TODO items left over. Change-Id: Ib062744acbf56f05d09857d244b78b35c0ef4d39 Signed-off-by: Julien Danjou <julien@danjou.info>
* | Fix optional keyring support, add basic keyring testsRob Crittenden2013-06-101-16/+12
|/ | | | | | | | | | | | | | | | | | | | | Commit 06d9437e8388b369546d760607f17cb5022750e9 made using a keyring optional by adding a function to handle the imports. The problem is that import needs to be available at a global level for it to be usable in other parts of the code. The function is replaced by a top-level try/except. Fixing the imports isn't enough to get keyring support working because in get_auth_ref_from_keyring() the wrong token was being used when evaluating token expiration. It was using the token already in the HTTPClient object and not the one returned from the keyring. Some simple tests were added to prevent future regressions. These tests will be skipped if the keyring or pickle packages are not installed. Change-Id: I1fe2c9e5cdf275df2047018368da2e4b3d2d6de2 Fixes: bug #1183072
* Fix unused imports(flake8 F401, F999)Dolph Mathews2013-06-031-2/+2
| | | | | | | | | | - F401: imported but unused - F999: syntax error in doctest Fixing a couple of the F401's simply required fixing the doctests syntax where the imports were actually in use. Change-Id: If78abbb143daf8d005a71c5ab52836df29c5e0cd
* Fix line continuations (flake8 E125, E126)Dolph Mathews2013-06-031-2/+2
| | | | | | | | - E125: continuation line does not distinguish itself from next logical line - E126: continuation line over-indented for hanging indent Change-Id: I626a6d5d57db927e8b239f90569b5601c772f28b
* Only add logging handlers if there currently aren't anyNicolas Simonds2013-05-211-1/+1
| | | | | | | | | | | This corrects an odd problem where Horizon would stand up multiple client objects, which would cause duplicate/triplicate/dozens of repeated log lines in its log files, due to multiple identical handlers being added to the logging object Fixes Bug 1182678 Change-Id: I020b3999c9008b996286ccb74a7801c96c43e71c
* Revert "Use TokenManager to get token"Dolph Mathews2013-04-301-8/+7
| | | This reverts commit 22228f526d6ea08b7006be1287afe959b93c23db which appears to be breaking the keystone gating
* Use TokenManager to get tokenJulien Danjou2013-04-191-7/+8
| | | | | | | | Instead of implementing token retrieval twice, let's use the code provided by the TokenManger to get a token in raw format from Keystone. Change-Id: I769be118ee137580cabd5cabcf7843e7afe1e456 Signed-off-by: Julien Danjou <julien@danjou.info>
* Merge "Pass json object when invoking exception handler."Jenkins2013-04-181-10/+10
|\
| * Pass json object when invoking exception handler.Lin Hua Cheng2013-04-171-10/+10
| | | | | | | | | | | | Fixes bug 1154753. Change-Id: I6ca7c758d42e8586c8adf2529ce5362108a57a56
* | Convert requests.ConnectionError to ClientExceptionBrian Waldon2013-04-021-5/+10
|/ | | | | | Fixes bug 1163678 Change-Id: I16201eda29a56e3c1e6008989260425ddc124ea6
* Work better in server env with no keyringsDavanum Srinivas2013-03-041-12/+12
| | | | | | | | | | We should not try loading keyrings if we dont' have to. We certainly should not print messages if keyrings are not even needed Fix for LP# 1145071 Change-Id: I700a2b40620359f6f1fbe03c6a6239d162ddea61
* Fix selef to self in class.Chmouel Boudjnah2013-02-201-1/+1
| | | | Change-Id: I1fec9908fb1aa915158996d57fdd82cfdf483535
* Merge "Implements token expiration handling"Jenkins2013-02-191-5/+27
|\
| * Implements token expiration handlingJulien Danjou2013-02-011-5/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | This implements handling of token expiration. Once the token is expired, this will request automatically for a new one. A special case is introduced if the user specified a token when the client is initialized: this is the auth_token_from_user. In this case, we can't know the expiration date, so we just assume it will never expire and don't handle it ourself. Change-Id: I3771ff5d669da015d4aa259de422c5d81aed3eb4 Signed-off-by: Julien Danjou <julien@danjou.info>
* | Merge "If you specify the --debug argument, it doesn't show the body of a ↵Jenkins2013-02-161-2/+2
|\ \ | | | | | | | | | POST request. The body (string rep) is at 'data' in the kwargs dict. 'body' was deleted prior to this call."
| * | If you specify the --debug argument, it doesn't show the body of a POST ↵Ruby Loo2013-01-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | request. The body (string rep) is at 'data' in the kwargs dict. 'body' was deleted prior to this call. Change-Id: Ieea3d11f5246ee785e41df3bc54ac61200808354 Fixes: bug #1104313
* | | Fix debug with requests.Chmouel Boudjnah2013-02-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | - From http://docs.python.org/2/library/functions.html#hasattr : hasattr(object, name) -- The arguments are an object and a string. - Fixes bug 1124084. Change-Id: I47283abff440abdf827598c2497519f3de510baf
* | | Allow requests up to 0.8 and greaterChuck Short2013-02-111-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The requests module dropped all configuration with the 1.0.0 release. There's no danger_mode and no 'verbose'' mode. The former shouldn't be necessary anymore and the latter can be done by setting a different log handler for the request.logging root logger. Change-Id: I41bfaf2574f6d7fc21f86e0124ceae7df6481eee Signed-off-by: Chuck Short <chuck.short@canonical.com>
* | | Treat HTTP code 400 and above as error.Lin Hua Cheng2013-02-051-1/+1
| |/ |/| | | | | | | | | Fixes bug 1116559. Change-Id: I4b12176599686f7e545b63c8e54cf9da6a1f963e
* | Merge "Remove useless code"Jenkins2013-01-241-1/+0
|\ \
| * | Remove useless codeJulien Danjou2013-01-231-1/+0
| |/ | | | | | | | | | | | | | | | | - There's no need to call parent init function since that's the default behaviour. - The token attribute is nor used nor updated anywhere. Change-Id: Ib0b2729a396a2d761931ce0e178c49c49814eb21 Signed-off-by: Julien Danjou <julien@danjou.info>
* | Allow request timeout to be specified.Joshua Harlow2013-01-181-0/+11
|/ | | | | | | | | Add a new cli argument (--timeout) which is by default 600 seconds which will be set in the requests library so that timeouts can occur correctly. Change-Id: I845c55dfb6f6b8345663ccdb5b150a2655f20026
* Merge "Use requests module for HTTP/HTTPS"Jenkins2012-12-201-30/+50
|\
| * Use requests module for HTTP/HTTPSDean Troyer2012-12-181-30/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | * Implement correct certificate verification * Add requests to tools/pip-requires * Fix OS_CACERT env var help text * Add info to README * Rework tests to use requests Pinned requests module to < 1.0 as 1.0.2 is now current in pipi as of 17Dec2012. Change-Id: I120d2c12d6f20ebe2fd7182ec8988cc73f623b80
* | Print to stderr when keyring module is missing.Dan Prince2012-12-141-1/+5
|/ | | | | | | | | | | | | | | Updates keystoneclient so that it uses a print statement to stderr instead of a logger.warn if stderr is a tty. This works around problems caused by the fact that logging isn't always initialized when this module import runs (and fails) thus causing: No handlers could be found for logger "keystoneclient.client" instead of the intended log message. Fixes LP Bug #1090396 Change-Id: I94e2c45eec14edfe3c2f356af6907aa827808a13
* Make use_keyring False by default.Dan Prince2012-12-061-1/+1
| | | | | | | | | | | | | | Updates the use_keyring option for the Keystone Client class to default to False by default. This provides for a much easier upgrade path the the most recent keystone-client code and is backwards compatible with the previous release. This does not change the default of the no_cache keystone CLI which will still enable use_keyring by default. Fixes LP Bug #1087434. Change-Id: Iaafadde660b0542a9c0a9c1bb742cb369b523a68
* bug-1040361: use keyring to store tokensGuang Yee2012-12-041-3/+150
| | | | | | | User can optionally turn off keyring by specifying the --no-cache option. It can also be disabled with environment variable OS-NO-CACHE. Change-Id: I8935260bf7fd6befa14798da9b4d02c81e65c417
* Add command to allow users to change their own passwordDerek Higgins2012-11-271-2/+9
| | | | | | | | | | | | Fixes Bug 1082539 The Equivalent of doing curl -X PATCH http://localhost:5000/v2.0/OS-KSCRUD/users/<userid> \ -H "Content-type: application/json" \ -H "X_Auth_Token: <authtokenid>" \ -d '{"user": {"password": "ABCD", "original_password": "DCBA"}}' Change-Id: Ia1a907c5fd138c4252196145b361f43671047a1a
* fixes auth_ref initialization errorJoe Heck2012-11-151-10/+25
| | | | | | | | | | | bug 1078589 * allow client values to be overridden, but use auth_ref if none available * added tests to match this flow * refactored tokens into test_fixtures.py file Change-Id: I771a2dee6dedf31d883417d9b4e6e64bbb620f14
* removing repeat attempt at authorization in clientJoe Heck2012-11-091-28/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | blueprint solidify-python-api * extended and updated documentation strings * updated README.rst with latest options * made debug a pass-through value, optionally set on client (instead of just being pulled from environment variable) * adding AccessInfo object and associated tests (access.AccessInfo meant to be a cacheable object external to client and ultimately to replace service_catalog and it's existing functionality) * extending authtoken to support lists of endpoints * maintaining a single entity for client.management_url with first from list of possible endpoints * create project_name and project_id synonyms to match tenant_name and tenant_id * replacing authenticate call to a pure method, not overloading the resource/manager path that confuses base URL concepts. * throw AuthorizationFailure if client attempts to access keystone resources before it has a management url * special case listing tenant using auth_url for unscoped tokens authorized through client * special case listing tokens.authenticate for Dashboard to allow unscoped tokens to hand back parity information to dashboard Change-Id: I4bb3a1b6a5ce2c4b3fbcebeb59116286cac8b2e3
* Merge "Replace refs to 'Keystone API' with 'Identity API'"Jenkins2012-11-061-1/+1
|\
| * Replace refs to 'Keystone API' with 'Identity API'Dolph Mathews2012-10-241-1/+1
| | | | | | | | | | | | | | Formally, OpenStack Keystone implements the OpenStack Identity API, and this is a client to the API, not to Keystone itself. Change-Id: If568866221a29ba041f0f2cd56dc81deeb9ebc00
* | Merge remote-tracking branch 'origin/feature/keystone-v3' into HEADDolph Mathews2012-10-301-1/+10
|\ \ | |/ |/| | | | | | | | | Conflicts: tests/v2_0/test_tenants.py Change-Id: I37037e60210edd574da86b1dc07aa73e6761e338
| * Allow serialization impl to be overriddenDolph Mathews2012-09-111-1/+4
| | | | | | | | Change-Id: I0f955c78897d4212f06942e59a7018dbe5d28540
| * Add support for HEAD and PATCHDolph Mathews2012-09-111-0/+6
| | | | | | | | Change-Id: Ic874c49b791e9d2cb3d44b15511cbb467a551589
* | add a new HTTPClient attr for setting the original IPIonuț Arțăriși2012-10-221-1/+5
| | | | | | | | | | | | | | | | | | | | The original IP is useful in cases where keystoneclient is used by a different openstack component and we need to know who made the original request. Otherwise it gets overwritten by e.g. Dashboard's host's IP. bug 1046837 Change-Id: Ic22c565e92010afd89c8573c375919215b70d73d