jonasrla edited a comment on issue #13934:
URL: https://github.com/apache/airflow/issues/13934#issuecomment-769856714


   I already thought a little about it. What do you think of doing this:
   ```python
               self.extra = self.parse_extra(uri_parts.query)
   
       def parse_extra(query):
           extra = dict()
           for key, value in parse_qsl(query, keep_blank_values=True):
               try:
                   extra[key] = json.loads(value.replace("'", '"'))
               except json.JSONDecodeError:
                   extra[key] = value
           return json.dumps(extra)
   ```
   
   That is, instead of using `dict()` as parser, use `json.loads()`. The only 
issue is that I'm using `try catch` to decide whether the value is a valid 
dictionary or just a string. I, myself, am not a huge fan of using `try catch` 
where it should be `if else`.
   
   What do you think?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to