diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-09-18 23:56:47 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-09-18 23:56:51 -0700 |
commit | 4d1ed63d914130d7d1c077f580ad5537e79e20ac (patch) | |
tree | 5c67f40d1f32d23b6ba6ea01cb7bed279ca5d775 | |
parent | 831ad507818aaf9c8eabdfae3c7bf13a54bbd55a (diff) | |
download | fatcat-4d1ed63d914130d7d1c077f580ad5537e79e20ac.tar.gz fatcat-4d1ed63d914130d7d1c077f580ad5537e79e20ac.zip |
fix another python codegen auth contamination bug
Seems to be the classic one where a dict as a default arg gets mutated
then reused across instances. Blech.
-rwxr-xr-x | python_openapi_client/codegen_python_client.sh | 35 | ||||
-rw-r--r-- | python_openapi_client/fatcat_openapi_client/configuration.py | 7 |
2 files changed, 37 insertions, 5 deletions
diff --git a/python_openapi_client/codegen_python_client.sh b/python_openapi_client/codegen_python_client.sh index 1058fd17..80a7f698 100755 --- a/python_openapi_client/codegen_python_client.sh +++ b/python_openapi_client/codegen_python_client.sh @@ -45,6 +45,41 @@ patch -p0 << END_PATCH Ref: https://openapi-generator.tech END_PATCH +# Another patch to fix nasty auth cross-contamination between instances of +# Configuration object. +patch -p0 << END_PATCH +--- fatcat_openapi_client/configuration.py ++++ fatcat_openapi_client/configuration.py +@@ -44,14 +44,11 @@ class Configuration(object): + Do not edit the class manually. + + :param host: Base url +- :param api_key: Dict to store API key(s) +- :param api_key_prefix: Dict to store API prefix (e.g. Bearer) + :param username: Username for HTTP basic authentication + :param password: Password for HTTP basic authentication + """ + + def __init__(self, host="https://api.fatcat.wiki/v0", +- api_key={}, api_key_prefix={}, + username="", password=""): + """Constructor + """ +@@ -62,10 +59,10 @@ class Configuration(object): + """Temp file folder for downloading files + """ + # Authentication Settings +- self.api_key = api_key ++ self.api_key = {} + """dict to store API key(s) + """ +- self.api_key_prefix = api_key_prefix ++ self.api_key_prefix = {} + """dict to store API prefix (e.g. Bearer) + """ + self.refresh_api_key_hook = None +END_PATCH + # these tests are basically no-ops mkdir -p tests/codegen cp -r $OUTPUT/test/* tests/codegen diff --git a/python_openapi_client/fatcat_openapi_client/configuration.py b/python_openapi_client/fatcat_openapi_client/configuration.py index 0cd7e1f2..b4aeff09 100644 --- a/python_openapi_client/fatcat_openapi_client/configuration.py +++ b/python_openapi_client/fatcat_openapi_client/configuration.py @@ -44,14 +44,11 @@ class Configuration(object): Do not edit the class manually. :param host: Base url - :param api_key: Dict to store API key(s) - :param api_key_prefix: Dict to store API prefix (e.g. Bearer) :param username: Username for HTTP basic authentication :param password: Password for HTTP basic authentication """ def __init__(self, host="https://api.fatcat.wiki/v0", - api_key={}, api_key_prefix={}, username="", password=""): """Constructor """ @@ -62,10 +59,10 @@ class Configuration(object): """Temp file folder for downloading files """ # Authentication Settings - self.api_key = api_key + self.api_key = {} """dict to store API key(s) """ - self.api_key_prefix = api_key_prefix + self.api_key_prefix = {} """dict to store API prefix (e.g. Bearer) """ self.refresh_api_key_hook = None |