Skip to content
This repository has been archived by the owner on Jun 2, 2020. It is now read-only.

Add user token authentication #53

Merged
merged 4 commits into from
May 29, 2015
Merged

Add user token authentication #53

merged 4 commits into from
May 29, 2015

Conversation

tenuki
Copy link
Contributor

@tenuki tenuki commented May 28, 2015

I've just added user_token "authentication".

Can't figure out how to add a test for it, but you can use this for testing:

__author__ = 'aweil'
import os
import unittest
import discogs_client

class UserTokenTest(unittest.TestCase):
    def setUp(self):
        with open(os.path.expanduser('~/.discogs_user_token'), 'rb') as f:
            self.discosgs_token = f.read().strip()

    def test_search(self):
        d = discogs_client.Client('TenukiWebApp1/0.1', user_token=self.discosgs_token)
        query_releases = d.search('Bit Shifter', type='artist')[0].releases[1].versions[0].labels[0].releases
        self.assertTrue( len(query_releases)>0)

if __name__ == '__main__':
    unittest.main()

Please let me know when/where to add documentation when available and if you want I to documentate it in the readme.

@tenuki
Copy link
Contributor Author

tenuki commented May 28, 2015

Also, I'm using in the test my registered user agent, please let me know if there is a default for this matter or if we should use an approach like the one for the user_token..

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.08%) to 84.85% when pulling 81b5f0b on tenuki:auth-user_token into 91974be on discogs:master.

@rodneykeeling
Copy link
Contributor

Code looks good to me. Neat feature to have! Please update the README file in the Authorization section that reflects this update.

@tenuki
Copy link
Contributor Author

tenuki commented May 28, 2015

README updated, please take a look, english is not my native languaje..

@tenuki
Copy link
Contributor Author

tenuki commented May 28, 2015

Changes done. Thanks!

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.08%) to 84.85% when pulling 5af4bbe on tenuki:auth-user_token into 91974be on discogs:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.08%) to 84.85% when pulling 3eca781 on tenuki:auth-user_token into 91974be on discogs:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.08%) to 84.85% when pulling 3eca781 on tenuki:auth-user_token into 91974be on discogs:master.

@rodneykeeling
Copy link
Contributor

Thanks! Looks good to me. 👍

Do you have a Discogs username? This is a feature I'd like to announce in the Discogs API forum, so if you'd like a shout-out/credit, please let me know!

rodneykeeling added a commit that referenced this pull request May 29, 2015
Add user token authentication
@rodneykeeling rodneykeeling merged commit 66540c5 into discogs:master May 29, 2015
@tenuki
Copy link
Contributor Author

tenuki commented May 29, 2015

Thanks you you. My discogs username: tenuki. Thanks.

@tenuki tenuki deleted the auth-user_token branch May 29, 2015 16:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants