Skip to main content

Unofficial python API for brain.fm

Project description

(very few commands implemented)

Quickstart

pip install brainfm
>>> import brainfm
>>> client = brainfm.Connection("your@email.here", "hunter2")
>>> client.get_stations()
[{'name': 'Cinematic Music Focus', 'station_id': 300,
  'canonical_name': 'explore.focus.cinematic'},
 {'name': 'Beach Focus', 'station_id': 53,
  'canonical_name': 'explore.focus.beach'},
 ...]
>>> client.get_station(station_id=53)
{'name': 'Beach Focus', 'station_id': 53, 'canonical_name': 'explore.focus.beach'}
>>> client.get_token(station_id=53)
{'session_token': '63f4b59b-93f4-45e6-b0c2-eb6b1582fb96',
 'group': 'FOCUS', 'name': 'Beach Focus', 'session_id': 121,
 'station_id': 53}

Now, open the stream using that token:

https://stream.brain.fm/?tkn=63f4b59b-93f4-45e6-b0c2-eb6b1582fb96

User-Agent

By default the user agent is github.com/numberoverzero/brain.fm followed by the project __version__. There is also a packaged browser-like user-agent:

>>> client = brainfm.Connection(...)
>>> client.user_agent = brainfm.BROWSER

Instead of filtering, maybe this will be a good metric for customer interest in an official API :heart:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brainfm-0.1.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

brainfm-0.1.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file brainfm-0.1.1.tar.gz.

File metadata

  • Download URL: brainfm-0.1.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for brainfm-0.1.1.tar.gz
Algorithm Hash digest
SHA256 409ad7b9df3c9c5c2ed9355508f2dda399bd35e8e3f677e2eebd7cf784d6622d
MD5 c9cce7ba430c913f7e28f853fa30de20
BLAKE2b-256 95799a81a239cc811c0b2bfcda3593f70227042e7c85255aa34b8bd68b7e79c1

See more details on using hashes here.

File details

Details for the file brainfm-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for brainfm-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5d46ca0d363ef86d42f53e376bbf3ac2ec2f0290a80fd220669e64547c8f7eb2
MD5 7da52906809ad02c9a1764b90f544d4a
BLAKE2b-256 f33d992648aafd3e47cc8037015538a7e67a8764a50531e6a8fd6e216409682e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page