示例#1
0
def test_remove(HttpMock):
    client = init_client()
    test_member_id = get_random_md5()
    test_playlist_id = get_random_md5()
    test_playlist_name = 'test playlist'
    test_track_id = get_random_md5()

    return_values = [
        (200, """<?xml version="1.0" encoding="utf-8"?>
                 <ResponsePlaylists>
                    <playlists>
                        <playlist id="%(test_playlist_id)s" name="%(test_playlist_name)s">
                            <tracks>
                                <track tracknumber="001" time="02:50" lengthseconds="170" comment="Make sure you’re
                                down the front for this fiery Post Punk workout."
                                composer="&quot;S. Milton, J. Wygens&quot;" publisher="HM"
                                name="Guerilla Pop" id="%(test_track_id)s" keywords=""
                                lyrics="" displaytitle="Guerilla Pop" genre="Pop / Rock" tempo=""
                                instrumentation="" bpm="" mixout="" frequency="44100" bitrate="1411" />
                            </tracks>
                        </playlist>
                    </playlists>
                </ResponsePlaylists>""" % locals()),
        (200, """<?xml version="1.0" encoding="utf-8"?>
                 <responsecode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                    <code>OK</code>
                 </responsecode>""",),
    ]

    http = build_http_mock(HttpMock, responses=return_values)
    member = Member(_client=client)
    member.id = test_member_id
    playlists = member.get_playlists()
    playlists[0].remove()
示例#2
0
from harvestmedia.api.config import Config
from harvestmedia.api.client import Client
from harvestmedia.api.member import Member

api_key = 'e1d5d645d2d984e499e816a7a314dfbd610149f124c3373455c37ad75ab3ffccf444a04a10953b62'
webservice_url = 'https://service.harvestmedia.net/HMP-WS.svc'

client = Client(api_key=api_key, debug_level='DEBUG')

#member = Member(client)
#member.username = '******'
#member.email = '*****@*****.**'
#member.firstname = 'Ryan1'
#member.lastname = 'Roemmich1'
#member.create()

#member = Member(client)
#member.send_password('test')

member = Member(client)
authenticated = member.authenticate('test', 'test', client)
print authenticated

playlists = member.get_playlists()

for playlist in playlists:
    print playlist.id + ': ' + playlist.name