Comments (22)
Hi @lorcan2440 ! Happy to hear you were able to get the NodeJS SDK up and running. I'm still curious why the Python SDK wasn't working for you. I'm really sorry you were having issues. I'm still looking into a possible cause. As always, if you ever have any questions or concerns please feel to keep reaching out to us. We're here to help :)
from deepgram-python-sdk.
I have the same issue, was hoping to use this for the deepgram challenge tonight, any fixes?
from deepgram-python-sdk.
I have the same issue, was hoping to use this for the deepgram challenge tonight, any fixes?
Hello, Mr. @lorcan2440 When I approached this error with deepgram technical team they replied me like this might be a library issues. After working with deepgram package I tried to install Flask-Socketio and few packages for my applications, from that time only I was started to facing this issue!! So as per the suggestion I uninstalled all python versions and pip too.. Then I reinstalled only python 3.7.9 and all required pip packages and now for me it's working fine... But still I'm fascinated to know where it could happened!
Thank you.
from deepgram-python-sdk.
Might I ask what OS / Python installation method you're using?
If you're using mac OS with the official installer, then this is a common issue with Python not properly integrating with system certificates; there's an Install Certificates.command
in the installation directory you can run to address it.
If not, I'm curious to hear more details!
from deepgram-python-sdk.
Hi, I'm using Windows 10, Python 3.9.7, installed using "pip install deepgram-sdk" with version deepgram-sdk-0.2.1.
I tried the solution given by @kavindevarajan but unfortunately it didn't work.
from deepgram-python-sdk.
Hi, @lorcan2440 sorry to hear you are having an issue. I understand how frustrating that can be. I'm the new Python Developer Advocate at Deepgram and helping out with the SDK. I would love to work together to see how we can resolve this error, so you can get up and running. Is there any way you can post your stack trace or any other error message that may help? It seems like it could be a certificate issue, but if could provide more detail that'd be great. Thank you!
from deepgram-python-sdk.
Hi @geekchick, i've got the following full traceback:
Requesting transcript...
Your file may take up to a couple minutes to process.
While you wait, did you know that Deepgram accepts over 40 audio file formats? Even MP4s.
To learn more about customizing your transcripts check out developers.deepgram.com.
Traceback (most recent call last):
File "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\site-packages\aiohttp\connector.py", line 986, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa
File "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\asyncio\base_events.py", line 1081, in create_connection
transport, protocol = await self._create_connection_transport(
File "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\asyncio\base_events.py", line 1111, in _create_connection_transport
await waiter
File "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\asyncio\sslproto.py", line 528, in data_received
ssldata, appdata = self._sslpipe.feed_ssldata(data)
File "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\asyncio\sslproto.py", line 188, in feed_ssldata
self._sslobj.do_handshake()
File "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\ssl.py", line 944, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\Users\lnick\Documents\Personal\Programming\Projects\_Testing\deepgram-test.py", line 22, in <module>
asyncio.run(main())
File "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "c:\Users\lnick\Documents\Personal\Programming\Projects\_Testing\deepgram-test.py", line 19, in main
response = await dg_client.transcription.prerecorded(source, {'punctuate': True})
File "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\site-packages\deepgram\transcription.py", line 181, in prerecorded
return await PrerecordedTranscription(
File "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\site-packages\deepgram\transcription.py", line 37, in __call__
return await _request(
File "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\site-packages\deepgram\_utils.py", line 112, in _request
return await attempt()
File "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\site-packages\deepgram\_utils.py", line 103, in attempt
raise exc
File "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\site-packages\deepgram\_utils.py", line 89, in attempt
async with aiohttp.request(
File "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\site-packages\aiohttp\client.py", line 1186, in __aenter__
self._resp = await self._coro
File "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\site-packages\aiohttp\client.py", line 535, in _request
conn = await self._connector.connect(
File "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\site-packages\aiohttp\connector.py", line 542, in connect
proto = await self._create_connection(req, traces, timeout)
File "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\site-packages\aiohttp\connector.py", line 907, in _create_connection _, proto = await self._create_direct_connection(req, traces, timeout)
File "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\site-packages\aiohttp\connector.py", line 1206, in _create_direct_connection
raise last_exc
File "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\site-packages\aiohttp\connector.py", line 1175, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\site-packages\aiohttp\connector.py", line 988, in _wrap_create_connection
raise ClientConnectorCertificateError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host api.deepgram.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129)')]
The exact code I ran was (from the "get a transcript via API or SDK" tutorial)
from deepgram import Deepgram
import asyncio, json
# The API key you created in step 1
DEEPGRAM_API_KEY = '************' # replaced
AUDIO_URL = 'https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav'
async def main():
# Initializes the Deepgram SDK
dg_client = Deepgram(DEEPGRAM_API_KEY)
source = {'url': AUDIO_URL}
print('Requesting transcript...')
print('Your file may take up to a couple minutes to process.')
print('While you wait, did you know that Deepgram accepts over 40 audio file formats? Even MP4s.')
print('To learn more about customizing your transcripts check out developers.deepgram.com.')
response = await dg_client.transcription.prerecorded(source, {'punctuate': True})
print(json.dumps(response, indent=4))
asyncio.run(main())
Things i've tried (main source)
- Adding
import ssl, certifi; sslcontext = ssl.create_default_context(cafile=certifi.where())
and callingprerecorded
with keywordssl=sslcontext
(don't think this is a valid keyword though) - Patching my
aiohttp.connector.TCPConnector
class to useverify_ssl=False
orssl=False
(this produces a different error includingFile "C:\Users\lnick\anaconda3\envs\AllLibs39\lib\site-packages\deepgram\_utils.py", line 101, in attempt raise Exception(f'DG: {exc}') Exception: DG: 400, message='Bad Request', url=URL('https://api.deepgram.com/v1/listen?punctuate=true')
- Using plain python, not using anaconda environments
- Using a local .mp4 file instead of the example .wav hosted by deepgram
I wanted to try the fix of using Install Certificates.command
but I was unable to find where this file is located. It's not in my site-packages/deepgram-sdk folder if that's what was meant.
Any help much appreciated.. would be great to get this working - i appreciate this error seems to be nothing to do with deepgram and may be hard to reproduce. I also know at least one of my team members also got this exact error while doing the same thing.
from deepgram-python-sdk.
Hi @lorcan2440 thank you for including your stack trace.
The Install Certificates.command
should be located in your Python installation folder, not in the deepgram-sdk folder.
I'm using a Mac so for me I can find the Install Certificates.command
by going to Applications > Python 3.10 > Install Certificates.command
. Then you double click on Install Certificates.command
. It'll open up a terminal and automatically run a script, then you should be able to get past the issue of the certificates.
Let me see if I can find an example in Windows OS and I'll post it in this thread.
from deepgram-python-sdk.
Interesting! Three things to check, I assume the former of which you've already done:
- Is your local copy of
certifi
fully updated? (pip install certifi --upgrade
) - Is your copy of Windows 10 fully updated? It's possible there was a system cert update that isn't downloaded.
- If you're working in an office, have you tried running this code on a different wireless network? Apparently web security solutions on office networks can sometimes break these sorts of connections - if one of your coworkers is also running into this, that may be relevant. (Of course, if you're working from home, then never mind.)
from deepgram-python-sdk.
Great suggestions @frumsdotxyz ! Hi @lorcan2440 here's more on certifi
on PyPI https://pypi.org/project/certifi/
from deepgram-python-sdk.
Hi @lorcan2440 when you have a minute can you try what @frumsdotxyz suggested and let us know if that worked. Thanks!
from deepgram-python-sdk.
Hi @frumsdotxyz and @geekchick , thanks for the suggestions...
- Yes, my
certifi
library is updated to 2021.10.8, double-checked by reinstalling - Yes, windows is telling me it's fully up to date
- The same issue happened both at home and when I first tried deepgram (at another location, connected to ethernet, no idea if that's relevant!).
A deepgram demonstrator was at the event where we first encountered the issue. He did not have this issue despite (i assume) being connected to the same internet. That being said, I think he was using the node.js interface, not Python.
I now regret not asking then! I'll try seeing if anyone else around me can get this to work.
from deepgram-python-sdk.
I've now asked someone who's working on Mac to run the same code (although with a locally stored video, shouldn't make a difference though surely) - they get a similar, but different error:
Requesting transcript...
Your file may take up to a couple minutes to process.
While you wait, did you know that Deepgram accepts over 40 audio file formats? Even MP4s.
To learn more about customizing your transcripts check out developers.deepgram.com.
Traceback (most recent call last):
File "/Users/miketsoi/opt/anaconda3/lib/python3.8/site-packages/deepgram/_utils.py", line 90, in attempt
async with aiohttp.request(
File "/Users/miketsoi/opt/anaconda3/lib/python3.8/site-packages/aiohttp/client.py", line 1186, in _aenter_
self._resp = await self._coro
File "/Users/miketsoi/opt/anaconda3/lib/python3.8/site-packages/aiohttp/client.py", line 640, in _request
resp.raise_for_status()
File "/Users/miketsoi/opt/anaconda3/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 1004, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 403, message='Forbidden', url=URL('https://api.deepgram.com/v1/listen?punctuate=true')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/miketsoi/Desktop/Lorcan.py", line 22, in <module>
asyncio.run(main())
File "/Users/miketsoi/opt/anaconda3/lib/python3.8/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/Users/miketsoi/opt/anaconda3/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/Users/miketsoi/Desktop/Lorcan.py", line 19, in main
response = await dg_client.transcription.prerecorded(source, {'punctuate': True})
File "/Users/miketsoi/opt/anaconda3/lib/python3.8/site-packages/deepgram/transcription.py", line 181, in prerecorded
return await PrerecordedTranscription(
File "/Users/miketsoi/opt/anaconda3/lib/python3.8/site-packages/deepgram/transcription.py", line 37, in _call_
return await _request(
File "/Users/miketsoi/opt/anaconda3/lib/python3.8/site-packages/deepgram/_utils.py", line 109, in _request
return await attempt()
File "/Users/miketsoi/opt/anaconda3/lib/python3.8/site-packages/deepgram/_utils.py", line 102, in attempt
raise (Exception(f'DG: {exc}') if exc.status < 500 else exc)
Exception: DG: 403, message='Forbidden', url=URL('https://api.deepgram.com/v1/listen?punctuate=true')
Maybe worth noting is they used the same API key as mine and also did not try the Install Certificates.command
, just out of convenience.
from deepgram-python-sdk.
HI @lorcan2440 that 403 error may be that the API Key expired. Can you try creating a new key, set it so it doesn't expire or expires in 8 hours, and have them run the Install Certificates.command
? I'm trying to get a Windows environment set up so I can try to replicate your error.
from deepgram-python-sdk.
Heya! I just got together a Windows 10 Python 3.10.2 install (official installer) and saw successful transcription with the above code, both with and without certifi
installed.
Could you try running Get-ChildItem -Recurse Cert:
in Powershell and passing along the output?
from deepgram-python-sdk.
Hi, here's my output from Get-ChildItem -Recurse Cert:
- it's 3000+ lines long, so i've dropped it here
I've also just tried with python 3.10 instead of 3.9, no change.
from deepgram-python-sdk.
@geekchick @frumsdotxyz - I've got the node.js SDK working instead - still not sure what's going on with python but this basically fixes my problem. Thanks for looking into it this far :)
from deepgram-python-sdk.
I have the same problem and unfortunately the suggestions with me didn't work. I switched to python and also started a clean environment. To be able to use it, I am sending requests with the API directly using verify=False:
requests.post(url,headers={'Authorization': 'Token testf2be0f58b64a79495193cda2c6f0cf2eca7f1793', 'Content-Type': 'audio/wav'}, data=audio, verify=False)
from deepgram-python-sdk.
Same issue here, I've done the Install Certificates.command and upgraded certifi but got the exact same issue with the Deepgram SDK for Python. I've tried to replicate the tutorial project with pre-recorded audio into Django. Code below:
async def transcribe(request):
body = json.loads(request.body)
print("got request in transcribe:", body)
print('sending recording to deepgram')
# submit the recording to deepgram
client = Deepgram(DEEPGRAM_API_KEY)
print("Deepgram object created")
deepgram_res = await client.transcription.prerecorded({"url": body["audio_url"]}, {"punctuate": True})
print('done processing request, sending deepgram response back to client',
deepgram_res)
return JsonResponse(deepgram_res)
from deepgram-python-sdk.
I am getting this error:
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129)
can anybody help me?
from deepgram-python-sdk.
anyone figure the solution to this?
from deepgram-python-sdk.
I got the same SSL errors on windows as described above in this thread
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1002)
I was able to get past the errors.
Please see the Readme for details of the issue and remediation on windows.
@Talha117 , @keizo, @lorcan2440 seems like you were encountering the same issue on windows.
from deepgram-python-sdk.
Related Issues (20)
- DeepgramSetupError Raised for Valid API Key on SDK Initialization HOT 3
- SyntaxError HOT 4
- large files cause broken pipe errors and left on pending in console HOT 10
- Implement `__dict__` for Response Objects HOT 1
- Doesn't Throw an Install Error on Python 3.9 or Lower
- `dg.listen.prerecorded.v("1").transcribe_url` fails on long audio with `httpx.HTTPStatusError: Client error '411 Length Required' for url` HOT 3
- AttributeError: 'list' object has no attribute 'items' HOT 2
- Object of type Sentiment is not JSON serializable HOT 2
- `Object of type Sentiment is not JSON serializable` everytime Python parses the `sentiment=<Sentiment.UNKNOWN: ''>` HOT 6
- DeepgramApiError: Please try again later. (Status: 503) HOT 21
- Implement Non-Blocking Async Threading HOT 4
- No module named pyaudio HOT 5
- Improve PyDocs Generation
- Socket exceptions are not caught in async live client HOT 3
- Implement Open Event, with `on_open` and `on_close` HOT 1
- Examine JSON DataClasses and Remove `Optional` for Those That are Required HOT 1
- Type Input, Return, etc Parameters Where Needed HOT 1
- Examine Legacy Syntax and Verify/Identify Issues HOT 1
- Extra (parameter) results not present in per-message metadata response HOT 1
- Deepgram audio timeout window error HOT 20
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deepgram-python-sdk.