示例#1
0
def test_mulitple_kwargs():
    got = helpers.append_to_querytring('/test/create',
                                       login='******',
                                       password='******')

    assert 'login=z3r0c00l' in got
    assert 'password=lovesecretgod' in got
示例#2
0
    def format_url(self, url: str) -> str:
        url = helpers.prepend_slash(url)
        url = self.host + url

        return helpers.append_to_querytring(
            url,
            account_id=self.account_id,
            api_key=self.api_key,
        )
示例#3
0
    def get_call_history(
        self,
        from_date: Optional[datetime] = None,
        to_date: Optional[datetime] = None,
        call_session_history_id: Optional[Iterable[int]] = None,
        app: str = None,
        with_calls: bool = True,
        with_records: bool = False,
        count: int = 20,
        offset: int = 0,
    ) -> 'VoximplantAPIResult':  # noqa:F821
        """Gets the call history.

        https://voximplant.com/docs/references/httpapi/managing_history#getcallhistory
        """

        params = {
            'from_date':
            self._convert_datetime(from_date) if from_date else None,
            'to_date':
            self._convert_datetime(to_date) if to_date else None,
            'call_session_history_id':
            self._convert_history_ids(call_session_history_id)
            if call_session_history_id else None,
            'application_id':
            self._get_application_id(app) if app else None,
            'with_calls':
            with_calls,
            'with_records':
            with_records,
            'count':
            count,
            'offset':
            offset,
        }

        params = {key: val for key, val in params.items() if val is not None}

        url = helpers.append_to_querytring('GetCallHistory', **params)
        return self.client.http.get(url)
示例#4
0
 def get_list(self, url: str) -> VoximplantAPIResult:
     return self.get(
         helpers.append_to_querytring(url, count=self.DEFAULT_COUNT))
示例#5
0
 def list(self, app: str) -> VoximplantAPIResult:
     application_id = self._get_application_id(app)
     url = helpers.append_to_querytring('GetQueues',
                                        application_id=application_id)
     return self.http.get_list(url)
示例#6
0
 def list(self, app: str):
     application_id = self._get_application_id(app)
     url = helpers.append_to_querytring('GetRules',
                                        application_id=application_id,
                                        with_scenarios=True)
     return self.http.get_list(url)
示例#7
0
def test_single_kwarg(input, expected):
    assert helpers.append_to_querytring(input,
                                        password='******') == expected