|
| 1 | +# Rev.ai Python SDK |
| 2 | + |
| 3 | +[](https://travis-ci.org/revdotcom/revai-python-sdk) |
| 4 | + |
| 5 | +## Documentation |
| 6 | + |
| 7 | +See the [API docs](https://www.rev.ai/docs) for more information about the API and |
| 8 | +more python examples. |
| 9 | + |
| 10 | +## Installation |
| 11 | + |
| 12 | +You don't need this source code unless you want to modify the package. If you just |
| 13 | +want to use the package, just run: |
| 14 | + |
| 15 | + pip install --upgrade rev_ai |
| 16 | + |
| 17 | +Install from source with: |
| 18 | + |
| 19 | + python setup.py install |
| 20 | + |
| 21 | +### Requirements |
| 22 | + |
| 23 | +- Python 2.7+ or Python 3.4+ |
| 24 | + |
| 25 | +## Usage |
| 26 | + |
| 27 | +All you need to get started is your Access Token, which can be generated on |
| 28 | +your [Settings Page](https://www.rev.ai/settings). Create a client with the |
| 29 | +given Access Token: |
| 30 | + |
| 31 | +```python |
| 32 | +from rev_ai import apiclient |
| 33 | + |
| 34 | +# create your client |
| 35 | +client = apiclient.RevAiAPIClient("ACCESS TOKEN") |
| 36 | +``` |
| 37 | + |
| 38 | +### Sending a file |
| 39 | + |
| 40 | +Once you've set up your client with your Access Token sending a file is easy! |
| 41 | + |
| 42 | +```python |
| 43 | +# you can send a local file |
| 44 | +job = client.send_job_local_file("FILE PATH") |
| 45 | + |
| 46 | +# or send a link to the file you want transcribed |
| 47 | +job = client.send_job_url("https://url-of-my-file") |
| 48 | +``` |
| 49 | + |
| 50 | +`job` will contain all the information normally found in a successful response from our |
| 51 | +[Submit Job](https://www.rev.ai/docs#operation/SubmitTranscriptionJob) endpoint. |
| 52 | + |
| 53 | +If you want to get fancy, both send job methods take `metadata`, `callback_url`, and a boolean |
| 54 | +`skip_diarization` as optional parameters, these are also described in the request body of |
| 55 | +the [Submit Job](https://www.rev.ai/docs#operation/SubmitTranscriptionJob) endpoint. |
| 56 | + |
| 57 | +### Checking your file's status |
| 58 | + |
| 59 | +You can check the status of your transcription job using its `id` |
| 60 | + |
| 61 | +```python |
| 62 | +job_details = client.get_job_details(job.id) |
| 63 | +``` |
| 64 | + |
| 65 | +`job_details` will contain all information normally found in a successful response from |
| 66 | +our [Get Job](https://www.rev.ai/docs#operation/GetJobById) endpoint |
| 67 | + |
| 68 | +### Getting your transcript |
| 69 | + |
| 70 | +Once your file is transcribed, you can get your transcript in a few different forms: |
| 71 | + |
| 72 | +```python |
| 73 | +# as text |
| 74 | +transcript_text = client.get_transcript_text(job.id) |
| 75 | + |
| 76 | +# as json |
| 77 | +transcript_json = client.get_transcript_json(job.id) |
| 78 | + |
| 79 | +# or as a python object |
| 80 | +transcript_object = client.get_transcript_object(job.id) |
| 81 | +``` |
| 82 | + |
| 83 | +Both the json and object forms contain all the formation outlined in the response |
| 84 | +of the [Get Transcript](https://www.rev.ai/docs#operation/GetTranscriptById) endpoint |
| 85 | +when using the json response schema. While the text output is a string containing |
| 86 | +just the text of your transcript |
0 commit comments