Git Product home page Git Product logo

shoutcast_api's Introduction

Shoutcast Radio Directory API

Actions Status

A Python module for interacting with the shoutcast radio directory api. For Python >= 3.

Getting started

Installation via pip:

$ pip install shoutcast-api

Manual installation:

$ git clone https://github.com/eadwinCode/shoutcast_api
$ cd shoutcast_api
$ python setup.py install

The module consists of the following sub-modules:

Usage:

from shoutcast_api import get_stations_by_now_playing
response = stations.get_stations_by_now_playing(api_key, ct='john legend', limit=100, br=128)

Error handling

All functions may raise exceptions if incorrect parameters are passed or other problems. If it is server-error APIException exception will be raised.

SHOUTcast API Usage Restrictions

By using our API, you agree to the following restrictions which are in place to protect the SHOUTcast brand and ServiceMark.

  • Please do not hammer the servers. We request reasonable usage and recommend that you utilize local caching.
  • Do not copy the shoutcast.com design, make your design as original as possible.
  • We reserve the right to revoke access for DevIDs which abuse the system.
  • We have included official logos for your usage below (with more to follow later).

API License Terms

For License Terms, here

shoutcast_api's People

Contributors

eadwincode avatar scls19fr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

scls19fr

shoutcast_api's Issues

Decompose API requests into 3 parts - base_url, end_point, params

Hello,

I noticed in your code

url = "genre/secondary?k={}&f=json&id={}".format(k, genre_id)

You should be aware that python-request is able to handle this (creating url with & between parameters) for you.

Decomposing API requests into 3 parts - base_url, end_point, parameters could be done like

base_url = "http://www.domain.com"
endpoint = "/genre/secondary"
params = {
  "k": k,
  "f": "json",
  "id": genre_id
}
url = base_url + end_point
response = requests.get(url, params=params)

It will be more readable.

Kind regards

Rename environment variable

Hello,

I noticed

api_key = os.getenv('api_key')

(and in other test files)

Maybe you should name this environment variable differently to avoid confusion between several API keys.

Generally, environment variables are upper cased.

SHOUTCAST_API_KEY could be a better name for that purpose.

Kind regards

ReadMe example

should be

from shoutcast_api import get_stations_by_now_playing
response = get_stations_by_now_playing(api_key, ct='john legend', limit=100, br=128)

Type checking / mypy

Hello,

I'm not a specialist of type annotations in Python, but I noticed you are using them quite intensively in your code.

Maybe you should consider using mypy for statical type checking and add it to your CI pipeline.

mypy can run as a pytest plugin
https://pypi.org/project/pytest-mypy/
(if you consider moving out from unittest to pytest as tests runner)

You should also be aware of https://www.python.org/dev/peps/pep-0585/

Importing those from typing is deprecated. Due to PEP 563 and the intention to minimize the runtime impact of typing, this deprecation will not generate DeprecationWarnings. Instead, type checkers may warn about such deprecated usage when the target version of the checked program is signalled to be Python 3.9 or newer. It's recommended to allow for those warnings to be silenced on a project-wide basis.

The deprecated functionality will be removed from the typing module in the first Python version released 5 years after the release of Python 3.9.0.

Kind regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.