# Beatport Plugin issue

**URL:** <https://discourse.beets.io/t/beatport-plugin-issue/2140>\
**Category:** Help\
**Created:** [August 24, 2022, 4:00pm UTC](https://discourse.beets.io/t/beatport-plugin-issue/2140 "2022-08-24T16:00:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nglha](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/nglha/32/666_2.png) [@nglha](https://discourse.beets.io/u/nglha)\
**Post date:** [August 24, 2022, 4:00pm UTC](https://discourse.beets.io/t/beatport-plugin-issue/2140/1 "2022-08-24T16:00:18Z")

</div>

Hi. Having trouble getting Beatport plugin working. Get the same problem on three different distros. Eager to get it working as most of my library is electronic dance music 🙂

Have installed required requests and requests\_oauthlib libraries.

‘beet version’ gives:

beets version 1.6.0  
Python version 3.10.4  
plugins: copyartifacts, deezer, discogs, embedart, fetchart, inline, lastgenre, random, zero

The [instructions](https://beets.readthedocs.io/en/stable/plugins/beatport.html) say ‘The first time you run the import command after enabling the plugin, it will ask you to authorize with Beatport by visiting the site in a browser. On the site you will be asked to enter your username and password to authorize beets to query the Beatport API.’

Instead get the following error:

beet import Music  
Traceback (most recent call last):  
File “/home/nglha/.local/lib/python3.8/site-packages/beetsplug/beatport.py”, line 290, in setup  
with open(self.\_tokenfile()) as f:  
FileNotFoundError: [Errno 2] No such file or directory: ‘/home/nglha/.config/beets/beatport\_token.json’

During handling of the above exception, another exception occurred:

beet import Music  
Traceback (most recent call last):  
File “/home/nglha/.local/lib/python3.8/site-packages/beetsplug/beatport.py”, line 290, in setup  
with open(self.\_tokenfile()) as f:  
FileNotFoundError: [Errno 2] No such file or directory: ‘/home/nglha/.config/beets/beatport\_token.json’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):  
File “/usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py”, line 485, in wrap\_socket  
cnx.do\_handshake()  
File “/usr/lib/python3/dist-packages/OpenSSL/SSL.py”, line 1915, in do\_handshake  
self.\_raise\_ssl\_error(self.\_ssl, result)  
File “/usr/lib/python3/dist-packages/OpenSSL/SSL.py”, line 1639, in \_raise\_ssl\_error  
raise SysCallError(errno, errorcode.get(errno))  
OpenSSL.SSL.SysCallError: (104, ‘ECONNRESET’)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):  
File “/usr/lib/python3/dist-packages/urllib3/connectionpool.py”, line 665, in urlopen  
httplib\_response = self.\_make\_request(  
File “/usr/lib/python3/dist-packages/urllib3/connectionpool.py”, line 376, in \_make\_request  
self.\_validate\_conn(conn)  
File “/usr/lib/python3/dist-packages/urllib3/connectionpool.py”, line 996, in _validate\_conn  
conn.connect()  
File “/usr/lib/python3/dist-packages/urllib3/connection.py”, line 366, in connect  
self.sock = ssl\_wrap\_socket(  
File "/usr/lib/python3/dist-packages/urllib3/util/ssl_.py", line 370, in ssl\_wrap\_socket  
return context.wrap\_socket(sock, server\_hostname=server\_hostname)  
File “/usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py”, line 491, in wrap\_socket  
raise ssl.SSLError(“bad handshake: %r” % e)  
ssl.SSLError: (“bad handshake: SysCallError(104, ‘ECONNRESET’)”,)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):  
File “/usr/lib/python3/dist-packages/requests/adapters.py”, line 439, in send  
resp = conn.urlopen(  
File “/usr/lib/python3/dist-packages/urllib3/connectionpool.py”, line 719, in urlopen  
retries = retries.increment(  
File “/usr/lib/python3/dist-packages/urllib3/util/retry.py”, line 436, in increment  
raise MaxRetryError(\_pool, url, error or ResponseError(cause))  
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘[oauth-api.beatport.com](http://oauth-api.beatport.com)’, port=443): Max retries exceeded with url: /identity/1/oauth/request-token (Caused by SSLError(SSLError(“bad handshake: SysCallError(104, ‘ECONNRESET’)”)))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):  
File “/home/nglha/.local/bin/beet”, line 8, in   
sys.exit(main())  
File “/home/nglha/.local/lib/python3.8/site-packages/beets/ui/ **init**.py”, line 1285, in main  
\_raw\_main(args)  
File “/home/nglha/.local/lib/python3.8/site-packages/beets/ui/ **init**.py”, line 1272, in \_raw\_main  
subcommand.func(lib, suboptions, subargs)  
File “/home/nglha/.local/lib/python3.8/site-packages/beets/ui/commands.py”, line 973, in import\_func  
import\_files(lib, paths, query)  
File “/home/nglha/.local/lib/python3.8/site-packages/beets/ui/commands.py”, line 943, in import\_files  
session.run()  
File “/home/nglha/.local/lib/python3.8/site-packages/beets/importer.py”, line 337, in run  
plugins.send(‘import\_begin’, session=self)  
File “/home/nglha/.local/lib/python3.8/site-packages/beets/plugins.py”, line 488, in send  
result = handler(\*\*arguments)  
File “/home/nglha/.local/lib/python3.8/site-packages/beets/plugins.py”, line 145, in wrapper  
return func(\*args, \*\*kwargs)  
File “/home/nglha/.local/lib/python3.8/site-packages/beetsplug/beatport.py”, line 294, in setup  
token, secret = self.authenticate(c\_key, c\_secret)  
File “/home/nglha/.local/lib/python3.8/site-packages/beetsplug/beatport.py”, line 305, in authenticate  
url = auth\_client.get\_authorize\_url()  
File “/home/nglha/.local/lib/python3.8/site-packages/beetsplug/beatport.py”, line 93, in get\_authorize\_url  
self.api.fetch\_request\_token(  
File “/home/nglha/.local/lib/python3.8/site-packages/requests\_oauthlib/oauth1\_session.py”, line 287, in fetch\_request\_token  
token = self.\_fetch\_token(url, \*\*request\_kwargs)  
File “/home/nglha/.local/lib/python3.8/site-packages/requests\_oauthlib/oauth1\_session.py”, line 365, in \_fetch\_token  
r = self.post(url, \*\*request\_kwargs)  
File “/usr/lib/python3/dist-packages/requests/sessions.py”, line 581, in post  
return self.request(‘POST’, url, data=data, json=json, \*\*kwargs)  
File “/usr/lib/python3/dist-packages/requests/sessions.py”, line 533, in request  
resp = self.send(prep, \*\*send\_kwargs)  
File “/usr/lib/python3/dist-packages/requests/sessions.py”, line 646, in send  
r = adapter.send(request, \*\*kwargs)  
File “/usr/lib/python3/dist-packages/requests/adapters.py”, line 514, in send  
raise SSLError(e, request=request)  
requests.exceptions.SSLError: HTTPSConnectionPool(host=‘[oauth-api.beatport.com](http://oauth-api.beatport.com)’, port=443): Max retries exceeded with url: /identity/1/oauth/request-token (Caused by SSLError(SSLError(“bad handshake: SysCallError(104, ‘ECONNRESET’)”)))

It appears to be looking for a ‘beatport\_token.json’ file but there is no mention of this on the plugin [page](https://beets.readthedocs.io/en/stable/plugins/beatport.html).

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [August 25, 2022, 2:50pm UTC](https://discourse.beets.io/t/beatport-plugin-issue/2140/2 "2022-08-25T14:50:47Z")

</div>

The relevant error is actually the last one in the chain: the `SSLError`. This kind of thing is terribly annoying to debug but usually indicates either intermittent network problems our out-of-date OpenSSL or certificates packages.

---

<div class="post-metadata">

**Author:** ![spinach](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@spinach](https://discourse.beets.io/u/spinach)\
**Post date:** [July 1, 2023, 7:32pm UTC](https://discourse.beets.io/t/beatport-plugin-issue/2140/4 "2023-07-01T19:32:47Z")

</div>

I’m getting a similar issue here. Initial import after enabling the plugin does not call the API and makes beets crash. Can I just add my beatport credentials to my beets config somehow? Anyone know the syntax for that?
