You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "zhongjiajie (via GitHub)" <gi...@apache.org> on 2023/04/04 08:52:01 UTC

[GitHub] [dolphinscheduler-sdk-python] zhongjiajie opened a new issue, #88: More pythonic HTTP task parameter

zhongjiajie opened a new issue, #88:
URL: https://github.com/apache/dolphinscheduler-sdk-python/issues/88

   currently like this
   
   ```py
   http = Http(
           name="http",
           url="http://www.google.com",
           http_method="GET",
           http_params=[
               {"prop": "abc", "httpParametersType": "PARAMETER", "value": "def"}
           ],
       )
   ```
   
   should be more pythonic


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] More pythonic HTTP task parameter [dolphinscheduler-sdk-python]

Posted by "HarshitNagpal29 (via GitHub)" <gi...@apache.org>.
HarshitNagpal29 commented on issue #88:
URL: https://github.com/apache/dolphinscheduler-sdk-python/issues/88#issuecomment-1873672032

   @zhongjiajie ok sir assign me i will try to solve it and make pull request
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] More pythonic HTTP task parameter [dolphinscheduler-sdk-python]

Posted by "HarshitNagpal29 (via GitHub)" <gi...@apache.org>.
HarshitNagpal29 commented on issue #88:
URL: https://github.com/apache/dolphinscheduler-sdk-python/issues/88#issuecomment-1874131047

   sir i have created a pull requested which is waiting for approval


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] More pythonic HTTP task parameter [dolphinscheduler-sdk-python]

Posted by "zhongjiajie (via GitHub)" <gi...@apache.org>.
zhongjiajie commented on issue #88:
URL: https://github.com/apache/dolphinscheduler-sdk-python/issues/88#issuecomment-1874122231

   I had assigned to you for this issue, looking forward your contribution


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] More pythonic HTTP task parameter [dolphinscheduler-sdk-python]

Posted by "deTian0 (via GitHub)" <gi...@apache.org>.
deTian0 commented on issue #88:
URL: https://github.com/apache/dolphinscheduler-sdk-python/issues/88#issuecomment-3222188166

   Hi, how do I set the headers for http requests in the new version?


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] More pythonic HTTP task parameter [dolphinscheduler-sdk-python]

Posted by "HarshitNagpal29 (via GitHub)" <gi...@apache.org>.
HarshitNagpal29 commented on issue #88:
URL: https://github.com/apache/dolphinscheduler-sdk-python/issues/88#issuecomment-1873440056

   @zhongjiajie sir i tried to transform your given snippet of code in more pythonic manner  you can see below, if you still want some changes then please tell me , also provide your valuable feedback as well as i am new to to open source community.   
   
   
      `from typing import List, Dict
   
   class Http:
       """Represents an HTTP request object."""
   
       def __init__(self, name: str, url: str, http_method: str, http_params: List[Dict[str, str]]):
           self.name = name
           self.url = url
           self.http_method = http_method
           self.http_params = http_params
   
   
   http_params = [
       {"prop": "abc", "http_parameters_type": "PARAMETER", "value": "def"},
       {"prop": "ghi", "http_parameters_type": "HEADER", "value": "jkl"},
      
   ]
   
   
   http = Http(name="http", url="http://www.google.com", http_method="GET", http_params=http_params)`
   
   **Changes i made: **
   
   > Introduced List[Dict[str, str]] which provides clear information that http_params should be a list of dictionaries where each dictionary has string keys and string values.
   
   > The __init__ method is explicitly defined within the Http class. 
   
   > And then some minor changes here and there just to increase readability of code and make it more pythonic.
   
   Thank You.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] More pythonic HTTP task parameter [dolphinscheduler-sdk-python]

Posted by "zhongjiajie (via GitHub)" <gi...@apache.org>.
zhongjiajie closed issue #88: More pythonic HTTP task parameter
URL: https://github.com/apache/dolphinscheduler-sdk-python/issues/88


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] More pythonic HTTP task parameter [dolphinscheduler-sdk-python]

Posted by "zhongjiajie (via GitHub)" <gi...@apache.org>.
zhongjiajie commented on issue #88:
URL: https://github.com/apache/dolphinscheduler-sdk-python/issues/88#issuecomment-1873558645

   hi @HarshitNagpal29 , we already have some utils function for parameter which you can see in https://github.com/apache/dolphinscheduler-sdk-python/blob/48586a3702df3f708044c8c03eedd442f21cf24f/src/pydolphinscheduler/core/parameter.py#L113
   
   and you can see when we add this, we can use param as dict type
   
   ```py
   task = Task(
       input_params={"key1": value1}
       output_params={"key2": value2}
   )
   ```
   
   so maybe we can change http code like
   
   ```diff
   http = Http(
           name="http",
           url="http://www.google.com",
           http_method="GET",
   -        http_params=[
   -            {"prop": "abc", "httpParametersType": "PARAMETER", "value": "def"}
   -        ],
   +.    http_params={"abc": "def"}
       )
   ```
   
   
   BTW, we have some test case https://github.com/apache/dolphinscheduler-sdk-python/blob/68d2670242ca9e47d4eb4b878334ab3fe972b262/tests/core/test_local_parameter.py#L97-L116 maybe you can have a look


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] More pythonic HTTP task parameter [dolphinscheduler-sdk-python]

Posted by "zhongjiajie (via GitHub)" <gi...@apache.org>.
zhongjiajie commented on issue #88:
URL: https://github.com/apache/dolphinscheduler-sdk-python/issues/88#issuecomment-1873558842

   And do you interested in this issue, I can assign you if you interested @HarshitNagpal29 


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] More pythonic HTTP task parameter [dolphinscheduler-sdk-python]

Posted by "HarshitNagpal29 (via GitHub)" <gi...@apache.org>.
HarshitNagpal29 commented on issue #88:
URL: https://github.com/apache/dolphinscheduler-sdk-python/issues/88#issuecomment-1874901793

   @zhongjiajie sir i have made all the changes which you told me please review it once and if there is still some issue then you can tell me again , thank you for your patience. 
   https://github.com/apache/dolphinscheduler-sdk-python/pull/130/commits/7e84357eb3da4ab488185982e90ea08906ccfddd


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] More pythonic HTTP task parameter [dolphinscheduler-sdk-python]

Posted by "basmul-pivoton (via GitHub)" <gi...@apache.org>.
basmul-pivoton commented on issue #88:
URL: https://github.com/apache/dolphinscheduler-sdk-python/issues/88#issuecomment-3387374143

   Hi, how do I set the parameter types for http requests in the new version. We have parameter, header and body parameters?
   If I use this version all my http parameters are incomplete because they have no type.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org