Skip to content

Instantly share code, notes, and snippets.

@nicolaspanel
Last active September 30, 2020 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicolaspanel/5e152e428228c5d988e2e6110c288a5d to your computer and use it in GitHub Desktop.
Save nicolaspanel/5e152e428228c5d988e2e6110c288a5d to your computer and use it in GitHub Desktop.
import requests
API_TOKEN = "<YOUR-API-TOKEN>" # see https://www.callity.fr/configuration/integrations
resp =requests.post(
url="https://www.callity.fr/api/speech_source_reviews/",
headers={
'Authorization': f'Bearer {API_TOKEN}',
},
json=dict(
language="fr", # or "en"
recording='<SOME-URL>',
recordingFormat="mp3", # or "wav"
type='call',
# OPTIONNAL
# perChannelContext=[
# dict(
# speakerFirstname='John',
# speakerLastname='Doe',
# speakerOrganizationName='Deleware Corporation',
# ),
# ],
# expectedPhrases=[
# dict(text='foo'),
# dict(text='bar', channel=0),
# ],
))
assert resp.status_code == 201
$ curl https://speech.callity.fr/api/transcriptions/ \
--header "Authorization: Bearer <API_TOKEN>" \
--header "Content-Type: application/json" \
--request POST \
--data '{"recording":"<PUBLIC_URL_TO_YOUR_FILE>","recordingFormat":"wav","callbackUrl":"https://<YOUR_DOMAIN>/<ANY_ENDPOINT>"}'
import requests
requests.post(
'https://speech.callity.fr/api/transcriptions/',
headers={
'Authorization': f'Bearer {API_TOKEN}',
},
json=dict(
recording=f'{PUBLIC_URL_TO_YOUR_FILE}',
recordingFormat='wav', # or 'mp3' or 'flac'
language='fr', # or 'en'
callbackUrl=f'https://{YOUR_PUBLIC_ENDPOINT}'), # take a look to https://ngrok.com/ (free) during development
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment