Bandwidth's Communication APIs
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 1.0.0
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit https://dev.bandwidth.com
Python >=3.6
If the python package is hosted on a repository, you can install directly using:
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)
Then import the package:
import bandwidthInstall via Setuptools.
python setup.py install --user(or sudo python setup.py install to install the package for all users)
Then import the package:
import bandwidthPlease follow the installation procedure and then run the following:
import time
import bandwidth
from pprint import pprint
from bandwidth.api import calls_api
from bandwidth.model.call_state import CallState
from bandwidth.model.create_call import CreateCall
from bandwidth.model.create_call_response import CreateCallResponse
from bandwidth.model.update_call import UpdateCall
from bandwidth.model.voice_api_error import VoiceApiError
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = bandwidth.Configuration(
host = "http://localhost"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP basic authorization: Basic
configuration = bandwidth.Configuration(
username = 'YOUR_USERNAME',
password = 'YOUR_PASSWORD'
)
# Enter a context with an instance of the API client
with bandwidth.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = calls_api.CallsApi(api_client)
account_id = "9900000" # str | Your Bandwidth Account ID
create_call = CreateCall(
to="+19195551234",
_from="+19195554321",
uui="eyJhbGciOiJIUzI1NiJ9.WyJoaSJd.-znkjYyCkgz4djmHUPSXl9YrJ6Nix_XvmlwKGFh5ERM;encoding=jwt,aGVsbG8gd29ybGQ=;encoding=base64",
application_id="1234-qwer-5679-tyui",
answer_url="https://www.myCallbackServer.com/webhooks/answer",
answer_method=CallbackMethodEnum("POST"),
username="mySecretUsername",
password="mySecretPassword1!",
answer_fallback_url="https://www.myFallbackServer.com/webhooks/answer",
answer_fallback_method=CallbackMethodEnum("POST"),
fallback_username="mySecretUsername",
fallback_password="mySecretPassword1!",
disconnect_url="disconnect_url_example",
disconnect_method=CallbackMethodEnum("POST"),
call_timeout=30,
callback_timeout=15,
machine_detection=MachineDetectionConfiguration(
mode=MachineDetectionModeEnum("async"),
detection_timeout=15,
silence_timeout=10,
speech_threshold=10,
speech_end_threshold=5,
machine_speech_end_threshold=5,
delay_result=False,
callback_url="https://myServer.com/bandwidth/webhooks/machineDetectionComplete",
callback_method=CallbackMethodEnum("POST"),
username="mySecretUsername",
password="mySecretPassword1!",
fallback_url="https://myFallbackServer.com/bandwidth/webhooks/machineDetectionComplete",
fallback_method=CallbackMethodEnum("POST"),
fallback_username="mySecretUsername",
fallback_password="mySecretPassword1!",
),
priority=5,
tag="tag_example",
) # CreateCall | JSON object containing information to create an outbound call
try:
# Create Call
api_response = api_instance.create_call(account_id, create_call)
pprint(api_response)
except bandwidth.ApiException as e:
print("Exception when calling CallsApi->create_call: %s\n" % e)All URIs are relative to http://localhost
| Class | Method | HTTP request | Description |
|---|---|---|---|
| CallsApi | create_call | POST /accounts/{accountId}/calls | Create Call |
| CallsApi | get_call_state | GET /accounts/{accountId}/calls/{callId} | Get Call State Information |
| CallsApi | update_call | POST /accounts/{accountId}/calls/{callId} | Update Call |
| CallsApi | update_call_bxml | PUT /accounts/{accountId}/calls/{callId}/bxml | Update Call BXML |
| ConferencesApi | download_conference_recording | GET /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media | Download Conference Recording |
| ConferencesApi | get_conference | GET /accounts/{accountId}/conferences/{conferenceId} | Get Conference Information |
| ConferencesApi | get_conference_member | GET /accounts/{accountId}/conferences/{conferenceId}/members/{memberId} | Get Conference Member |
| ConferencesApi | get_conference_recording | GET /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId} | Get Conference Recording Information |
| ConferencesApi | list_conference_recordings | GET /accounts/{accountId}/conferences/{conferenceId}/recordings | Get Conference Recordings |
| ConferencesApi | list_conferences | GET /accounts/{accountId}/conferences | Get Conferences |
| ConferencesApi | update_conference | POST /accounts/{accountId}/conferences/{conferenceId} | Update Conference |
| ConferencesApi | update_conference_bxml | PUT /accounts/{accountId}/conferences/{conferenceId}/bxml | Update Conference BXML |
| ConferencesApi | update_conference_member | PUT /accounts/{accountId}/conferences/{conferenceId}/members/{memberId} | Update Conference Member |
| MFAApi | generate_messaging_code | POST /accounts/{accountId}/code/messaging | Messaging Authentication Code |
| MFAApi | generate_voice_code | POST /accounts/{accountId}/code/voice | Voice Authentication Code |
| MFAApi | verify_code | POST /accounts/{accountId}/code/verify | Verify Authentication Code |
| MediaApi | delete_media | DELETE /users/{accountId}/media/{mediaId} | Delete Media |
| MediaApi | get_media | GET /users/{accountId}/media/{mediaId} | Get Media |
| MediaApi | list_media | GET /users/{accountId}/media | List Media |
| MediaApi | upload_media | PUT /users/{accountId}/media/{mediaId} | Upload Media |
| MessagesApi | create_message | POST /users/{accountId}/messages | Create Message |
| MessagesApi | list_messages | GET /users/{accountId}/messages | List Messages |
| ParticipantsApi | create_participant | POST /accounts/{accountId}/participants | Create Participant |
| ParticipantsApi | delete_participant | DELETE /accounts/{accountId}/participants/{participantId} | Delete Participant |
| ParticipantsApi | get_participant | GET /accounts/{accountId}/participants/{participantId} | Get Participant |
| PhoneNumberLookupApi | create_lookup | POST /accounts/{accountId}/tnlookup | Create Lookup |
| PhoneNumberLookupApi | get_lookup_status | GET /accounts/{accountId}/tnlookup/{requestId} | Get Lookup Request Status |
| RecordingsApi | delete_call_transcription | DELETE /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Delete Transcription |
| RecordingsApi | delete_recording | DELETE /accounts/{accountId}/calls/{callId}/recordings/{recordingId} | Delete Recording |
| RecordingsApi | delete_recording_media | DELETE /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media | Delete Recording Media |
| RecordingsApi | download_call_recording | GET /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media | Download Recording |
| RecordingsApi | get_call_recording | GET /accounts/{accountId}/calls/{callId}/recordings/{recordingId} | Get Call Recording |
| RecordingsApi | get_call_transcription | GET /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Get Transcription |
| RecordingsApi | list_account_call_recordings | GET /accounts/{accountId}/recordings | Get Call Recordings |
| RecordingsApi | list_call_recordings | GET /accounts/{accountId}/calls/{callId}/recordings | List Call Recordings |
| RecordingsApi | transcribe_call_recording | POST /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Create Transcription Request |
| RecordingsApi | update_call_recording_state | PUT /accounts/{accountId}/calls/{callId}/recording | Update Recording |
| SessionsApi | add_participant_to_session | PUT /accounts/{accountId}/sessions/{sessionId}/participants/{participantId} | Add Participant to Session |
| SessionsApi | create_session | POST /accounts/{accountId}/sessions | Create Session |
| SessionsApi | delete_session | DELETE /accounts/{accountId}/sessions/{sessionId} | Delete Session |
| SessionsApi | get_participant_subscriptions | GET /accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions | Get Participant Subscriptions |
| SessionsApi | get_session | GET /accounts/{accountId}/sessions/{sessionId} | Get Session |
| SessionsApi | list_session_participants | GET /accounts/{accountId}/sessions/{sessionId}/participants | List Participants in Session |
| SessionsApi | remove_participant_from_session | DELETE /accounts/{accountId}/sessions/{sessionId}/participants/{participantId} | Remove Participant from Session |
| SessionsApi | update_participant_subscriptions | PUT /accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions | Update Participant Subscriptions |
| StatisticsApi | get_statistics | GET /accounts/{accountId}/statistics | Get Account Statistics |
- AccountStatistics
- CallCallback
- CallDirectionEnum
- CallRecordingMetadata
- CallState
- CallStateEnum
- CallbackMethodEnum
- CodeRequest
- Conference
- ConferenceCallback
- ConferenceMember
- ConferenceRecordingMetadata
- ConferenceStateEnum
- CreateCall
- CreateCallResponse
- CreateLookupResponse
- CreateParticipantRequest
- CreateParticipantResponse
- DeferredResult
- DeviceApiVersionEnum
- Diversion
- FileFormatEnum
- ForbiddenRequest
- ListMessageDirectionEnum
- ListMessageItem
- LookupRequest
- LookupResult
- LookupStatus
- LookupStatusEnum
- MachineDetectionConfiguration
- MachineDetectionModeEnum
- Media
- Message
- MessageDirectionEnum
- MessageRequest
- MessageStatusEnum
- MessageTypeEnum
- MessagesList
- MessagingCodeResponse
- MessagingRequestError
- MfaForbiddenRequestError
- MfaRequestError
- MfaUnauthorizedRequestError
- PageInfo
- Participant
- ParticipantSubscription
- PriorityEnum
- PublishPermissionsEnum
- RecordingStateEnum
- RedirectMethodEnum
- RequestError
- Session
- Subscriptions
- Tag
- TnLookupRequestError
- TranscribeRecording
- Transcription
- TranscriptionList
- TranscriptionMetadata
- UnauthorizedRequest
- UpdateCall
- UpdateCallRecording
- UpdateConference
- UpdateConferenceMember
- VerifyCodeRequest
- VerifyCodeResponse
- VoiceApiError
- VoiceCodeResponse
- Type: HTTP basic authentication
If the OpenAPI document is large, imports in bandwidth.apis and bandwidth.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:
Solution 1: Use specific imports for apis and models like:
from bandwidth.api.default_api import DefaultApifrom bandwidth.model.pet import Pet
Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:
import sys
sys.setrecursionlimit(1500)
import bandwidth
from bandwidth.apis import *
from bandwidth.models import *