How to use the hubspot3.forms.FormSubmissionClient.ResponseCode function in hubspot3

To help you get started, we’ve selected a few hubspot3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jpetrucciani / hubspot3 / hubspot3 / forms.py View on Github external
and if you pass a context:
            it will json dump for you, and place inside the data

        :see: https://developers.hubspot.com/docs/methods/forms/submit_form
        """
        if context:
            data["hs_context"] = json.dumps(context)
        subpath = "{}/{}".format(portal_id, form_guid)
        opts = {"content_type": "application/x-www-form-urlencoded"}
        options.update(opts)
        response = self._call(
            subpath, method="POST", data=urlencode(data), raw=True, **options
        )
        if response.status in [
            FormSubmissionClient.ResponseCode.SUCCESS,
            FormSubmissionClient.ResponseCode.SUCCESS_AND_REDIRECT,
        ]:
            return response
        if response.status == FormSubmissionClient.ResponseCode.NOT_FOUND:
            raise HubspotNotFound(response, None)
        if response.status == FormSubmissionClient.ResponseCode.ERROR:
            raise HubspotServerError(response, None)

        # shouldn't ever get here, but raise anyways
        raise HubspotServerError(response, None)
github jpetrucciani / hubspot3 / hubspot3 / forms.py View on Github external
if context:
            data["hs_context"] = json.dumps(context)
        subpath = "{}/{}".format(portal_id, form_guid)
        opts = {"content_type": "application/x-www-form-urlencoded"}
        options.update(opts)
        response = self._call(
            subpath, method="POST", data=urlencode(data), raw=True, **options
        )
        if response.status in [
            FormSubmissionClient.ResponseCode.SUCCESS,
            FormSubmissionClient.ResponseCode.SUCCESS_AND_REDIRECT,
        ]:
            return response
        if response.status == FormSubmissionClient.ResponseCode.NOT_FOUND:
            raise HubspotNotFound(response, None)
        if response.status == FormSubmissionClient.ResponseCode.ERROR:
            raise HubspotServerError(response, None)

        # shouldn't ever get here, but raise anyways
        raise HubspotServerError(response, None)
github jpetrucciani / hubspot3 / hubspot3 / forms.py View on Github external
:see: https://developers.hubspot.com/docs/methods/forms/submit_form
        """
        if context:
            data["hs_context"] = json.dumps(context)
        subpath = "{}/{}".format(portal_id, form_guid)
        opts = {"content_type": "application/x-www-form-urlencoded"}
        options.update(opts)
        response = self._call(
            subpath, method="POST", data=urlencode(data), raw=True, **options
        )
        if response.status in [
            FormSubmissionClient.ResponseCode.SUCCESS,
            FormSubmissionClient.ResponseCode.SUCCESS_AND_REDIRECT,
        ]:
            return response
        if response.status == FormSubmissionClient.ResponseCode.NOT_FOUND:
            raise HubspotNotFound(response, None)
        if response.status == FormSubmissionClient.ResponseCode.ERROR:
            raise HubspotServerError(response, None)

        # shouldn't ever get here, but raise anyways
        raise HubspotServerError(response, None)
github jpetrucciani / hubspot3 / hubspot3 / forms.py View on Github external
this will urlencode the data automatically
        and if you pass a context:
            it will json dump for you, and place inside the data

        :see: https://developers.hubspot.com/docs/methods/forms/submit_form
        """
        if context:
            data["hs_context"] = json.dumps(context)
        subpath = "{}/{}".format(portal_id, form_guid)
        opts = {"content_type": "application/x-www-form-urlencoded"}
        options.update(opts)
        response = self._call(
            subpath, method="POST", data=urlencode(data), raw=True, **options
        )
        if response.status in [
            FormSubmissionClient.ResponseCode.SUCCESS,
            FormSubmissionClient.ResponseCode.SUCCESS_AND_REDIRECT,
        ]:
            return response
        if response.status == FormSubmissionClient.ResponseCode.NOT_FOUND:
            raise HubspotNotFound(response, None)
        if response.status == FormSubmissionClient.ResponseCode.ERROR:
            raise HubspotServerError(response, None)

        # shouldn't ever get here, but raise anyways
        raise HubspotServerError(response, None)