You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by jl...@apache.org on 2016/11/02 18:36:56 UTC

incubator-airflow git commit: [AIRFLOW-411] Add Python3 support to hipchat_operator

Repository: incubator-airflow
Updated Branches:
  refs/heads/master 39499e8aa -> 26c2df33b


[AIRFLOW-411] Add Python3 support to hipchat_operator

Closes #1721 from d-lee/hipchat_operator_python3


Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/26c2df33
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/26c2df33
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/26c2df33

Branch: refs/heads/master
Commit: 26c2df33bea5f04378131e49e84d1b7e66b36b4b
Parents: 39499e8
Author: Dmitriy Lee <dm...@gmail.com>
Authored: Wed Nov 2 14:36:09 2016 -0400
Committer: Jeremiah Lowin <jl...@jlowin.local>
Committed: Wed Nov 2 14:36:15 2016 -0400

----------------------------------------------------------------------
 airflow/contrib/operators/hipchat_operator.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/26c2df33/airflow/contrib/operators/hipchat_operator.py
----------------------------------------------------------------------
diff --git a/airflow/contrib/operators/hipchat_operator.py b/airflow/contrib/operators/hipchat_operator.py
index cdfd573..0bc7cbe 100644
--- a/airflow/contrib/operators/hipchat_operator.py
+++ b/airflow/contrib/operators/hipchat_operator.py
@@ -12,6 +12,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from builtins import str
+
 from airflow.utils.decorators import apply_defaults
 from airflow.models import BaseOperator
 from airflow.exceptions import AirflowException
@@ -27,7 +29,6 @@ class HipChatAPIOperator(BaseOperator):
     at https://www.hipchat.com/docs/apiv2. Before using any HipChat API operators you need
     to get an authentication token at https://www.hipchat.com/docs/apiv2/auth.
     In the future additional HipChat operators will be derived from this class as well.
-
     :param token: HipChat REST API authentication token
     :type token: str
     :param base_url: HipChat REST API base url.
@@ -50,7 +51,6 @@ class HipChatAPIOperator(BaseOperator):
         """
         Used by the execute function. Set the request method, url, and body of HipChat's
         REST API call.
-
         Override in child class. Each HipChatAPI child operator is responsible for having
         a prepare_request method call which sets self.method, self.url, and self.body.
         """
@@ -76,7 +76,6 @@ class HipChatAPISendRoomNotificationOperator(HipChatAPIOperator):
     """
     Send notification to a specific HipChat room.
     More info: https://www.hipchat.com/docs/apiv2/method/send_room_notification
-
     :param room_id: Room in which to send notification on HipChat
     :type room_id: str
     :param message: The message body
@@ -110,7 +109,7 @@ class HipChatAPISendRoomNotificationOperator(HipChatAPIOperator):
             'notify': False,
             'card': None
         }
-        for (prop, default) in default_options.iteritems():
+        for (prop, default) in default_options.items():
             setattr(self, prop, kwargs.get(prop, default))
 
     def prepare_request(self):
@@ -127,4 +126,4 @@ class HipChatAPISendRoomNotificationOperator(HipChatAPIOperator):
         self.method = 'POST'
         self.url = '%s/room/%s/notification' % (self.base_url, self.room_id)
         self.body = json.dumps(dict(
-            (k.encode('utf-8'), v.encode('utf-8')) for k, v in params.iteritems() if v))
+            (str(k), str(v)) for k, v in params.items() if v))