soundcloud

A Python wrapper around the Soundcloud API

https://github.com/soundcloud/soundcloud-python

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 17 committers (5.9%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.1%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

A Python wrapper around the Soundcloud API

Basic Info
  • Host: GitHub
  • Owner: soundcloud
  • License: bsd-2-clause
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 78.1 KB
Statistics
  • Stars: 109
  • Watchers: 76
  • Forks: 31
  • Open Issues: 1
  • Releases: 0
Created about 6 years ago · Last pushed over 2 years ago
Metadata Files
Readme License

README.rst

=====================================
⚠️⚠️DEPRECATED - NO LONGER MAINTAINED⚠️⚠️
=====================================
This repository is no longer maintained by the SoundCloud team due to capacity constraints. We're instead focusing our efforts on improving the API & the developer platform. Please note, at the time of updating this, the repo is already not in sync with the latest API changes. 

We recommend the community to fork this repo in order to maintain the SDK. We'd be more than happy to make a reference on our developer that the developers can use different SDKs build by the community. In case you need to reach out to us, please head over to https://github.com/soundcloud/api/issues  

=================
soundcloud-python
=================

.. image:: https://travis-ci.org/soundcloud/soundcloud-python.svg
    :target: https://travis-ci.org/soundcloud/soundcloud-python

A friendly wrapper around the `Soundcloud API`_.

.. _Soundcloud API: http://developers.soundcloud.com/

Installation
------------

To install soundcloud-python, simply: ::

    pip install soundcloud

Or if you're not hip to the pip: ::

    easy_install soundcloud

Basic Use
---------

To use soundcloud-python, you must first create a `Client` instance,
passing at a minimum the client id you obtained when you `registered
your app`_: ::

    import soundcloud

    client = soundcloud.Client(client_id=YOUR_CLIENT_ID)

The client instance can then be used to fetch or modify resources: ::

    tracks = client.get('/tracks', limit=10)
    for track in tracks.collection:
        print track.title
    app = client.get('/apps/124')
    print app.permalink_url

.. _registered your app: http://soundcloud.com/you/apps/

Authentication
--------------

All `OAuth2 authorization flows`_ supported by the Soundcloud API are
available in soundcloud-python. If you only need read-only access to
public resources, simply provide a client id when creating a `Client`
instance: ::

    import soundcloud

    client = soundcloud.Client(client_id=YOUR_CLIENT_ID)
    track = client.get('/tracks/30709985')
    print track.title

If however, you need to access private resources or modify a resource,
you will need to have a user delegate access to your application. To do
this, you can use one of the following OAuth2 authorization flows.

**Authorization Code Flow**

The `Authorization Code Flow`_ involves redirecting the user to soundcloud.com
where they will log in and grant access to your application: ::

    import soundcloud

    client = soundcloud.Client(
        client_id=YOUR_CLIENT_ID,
        client_secret=YOUR_CLIENT_SECRET,
        redirect_uri='http://yourapp.com/callback'
    )
    redirect(client.authorize_url())

Note that `redirect_uri` must match the value you provided when you
registered your application. After granting access, the user will be
redirected to this uri, at which point your application can exchange
the returned code for an access token: ::

    access_token, expires, scope, refresh_token = client.exchange_token(
        code=request.args.get('code'))
    render_text("Hi There, %s" % client.get('/me').username)


**User Credentials Flow**

The `User Credentials Flow`_ allows you to exchange a username and
password for an access token. Be cautious about using this flow, it's
not very kind to ask your users for their password, but may be
necessary in some use cases: ::

    import soundcloud

    client = soundcloud.Client(
        client_id=YOUR_CLIENT_ID,
        client_secret=YOUR_CLIENT_SECRET,
        username='jane@example.com',
        password='janespassword'
    )
    print client.get('/me').username

.. _`OAuth2 authorization flows`: http://developers.soundcloud.com/docs/api/authentication
.. _`Authorization Code Flow`: http://developers.soundcloud.com/docs/api/authentication#user-agent-flow
.. _`User Credentials Flow`: http://developers.soundcloud.com/docs/api/authentication#user-credentials-flow

Examples
--------

Resolve a track and print its id: ::

    import soundcloud

    client = soundcloud.Client(client_id=YOUR_CLIENT_ID)

    track = client.get('/resolve', url='http://soundcloud.com/forss/flickermood')

    print track.id

Upload a track: ::

    import soundcloud

    client = soundcloud.Client(access_token="a valid access token")

    track = client.post('/tracks', track={
        'title': 'This is a sample track',
        'sharing': 'private',
        'asset_data': open('mytrack.mp4', 'rb')
    })

    print track.title

Start following a user: ::

    import soundcloud

    client = soundcloud.Client(access_token="a valid access token")
    user_id_to_follow = 123
    client.put('/me/followings/%d' % user_id_to_follow)

Update your profile description: ::

    import soundcloud

    client = soundcloud.Client(access_token="a valid access token")
    client.put('/me', user={
        'description': "a new description"
    })

Proxy Support
-------------

If you're behind a proxy, you can specify it when creating a client: ::

    import soundcloud

    proxies = {
        'http': 'example.com:8000'
    }
    client = soundcloud.Client(access_token="a valid access token",
                               proxies=proxies)

The proxies kwarg is a dictionary with protocols as keys and host:port as values.

Redirects
---------

By default, 301 or 302 redirects will be followed for idempotent methods. There are certain cases where you may want to disable this, for example: ::

    import soundcloud

    client = soundcloud.Client(access_token="a valid access token")
    track = client.get('/tracks/293/stream', allow_redirects=False)
    print track.location

Will print a tracks streaming URL. If ``allow_redirects`` was omitted, a binary stream would be returned instead.

Running Tests
-------------

To run the tests, run: ::

    $ pip install -r requirements.txt
    $ nosetests --with-doctest
    ..................

Success!

Contributing
------------

Contributions are awesome. You are most welcome to `submit issues`_,
or `fork the repository`_.

soundcloud-python is published under a `BSD License`_.

.. _`submit issues`: https://github.com/soundcloud/soundcloud-python/issues
.. _`fork the repository`: https://github.com/soundcloud/soundcloud-python
.. _`BSD License`: https://github.com/soundcloud/soundcloud-python/blob/master/README

Owner

  • Name: SoundCloud
  • Login: soundcloud
  • Kind: organization
  • Location: Berlin, Germany

GitHub Events

Total
  • Watch event: 10
  • Fork event: 4
Last Year
  • Watch event: 10
  • Fork event: 4

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 96
  • Total Committers: 17
  • Avg Commits per committer: 5.647
  • Development Distribution Score (DDS): 0.385
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Paul Osman p****l@e****a 59
Martey Dodoo m****y@m****m 7
Erik Michaels-Ober s****k@g****m 6
Keith Hughitt k****t@g****m 6
Arthur Maciejewicz a****2@n****u 3
Jarl Gunnar T. Flaten j****n@g****m 3
Peter Sobot g****b@p****m 2
Arthur Maciejewicz a****z@g****m 1
Andrey Popp 8****y@g****m 1
Donal O'Brien o****l@g****m 1
Forrest Cahoon f****n@g****m 1
Javier Domingo j****1@g****m 1
Max Veytsman m****m@o****m 1
Philipp Joram p****r@t****e 1
Rahul 6****c 1
Thiago Caiubi t****i@g****m 1
Willem Labu w****e@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 0
  • Total pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: 2 days
  • Total issue authors: 0
  • Total pull request authors: 3
  • Average comments per issue: 0
  • Average comments per pull request: 0.67
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • remover (2)
  • sebampuero (1)
  • Winspear (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 695 last-month
  • Total docker downloads: 93
  • Total dependent packages: 2
  • Total dependent repositories: 310
  • Total versions: 16
  • Total maintainers: 2
pypi.org: soundcloud

A friendly wrapper library for the Soundcloud API

  • Versions: 16
  • Dependent Packages: 2
  • Dependent Repositories: 310
  • Downloads: 695 Last month
  • Docker Downloads: 93
Rankings
Dependent repos count: 0.8%
Docker downloads count: 2.2%
Dependent packages count: 3.2%
Average: 4.3%
Downloads: 5.1%
Stargazers count: 7.3%
Forks count: 7.3%
Maintainers (2)
Last synced: 11 months ago

Dependencies

requirements.txt pypi
  • fudge ==1.0.3
  • nose >=1.1.2
  • requests >=1.0.0
  • simplejson >=2.0
  • six >=1.2.0
setup.py pypi
  • fudge >=1.0.3
  • requests >=0.14.0
  • simplejson >=2.0