Stuck with oauth when trying audiomack api - python

All I know about API authentication is just password and bearer token. (and NO AUTH too ;)) And I got this OAuth problem when I was trying to use audiomack API.
https://www.audiomack.com/data-api/docs
This is their API documentation. They say
Rather than manually creating code for OAuth, we recommend instead using one of the pre-built libraries available for your programming language.
And I got piles of python libraries here: https://oauth.net/1/#:~:text=Max%20Countryman%20maintains,Tornado%20Auth%20package
Because I am new to OAuth, and also do not know how to get this consumer key and secret from my audiomack account (newly created for test use), these repos give no meaning to me.
Is there anyone who can help me out? I want to know how to make a proper OAuth step to use this API.
A step-by-step guidance or relevant link will be appreciated. Thanks in advance.

Related

Python and Quickbooks API

I am wondering if someone has sample code of a working python connection to the Quickbooks API. From the documentation of Intuit-Oaut, Python-Intuit, or intuit developer docs I cant figure out how to connect. Would like to connect and then post sample JSON (for example a sales receipt), but cant seem to connect.
I am new to python and new to quickbooks api so apologies if this seems basic or am missing a step.
Followed steps on:
-https://oauth-pythonclient.readthedocs.io/en/latest/user-guide.html#authorize-your-app
-https://github.com/intuit/oauth-pythonclient
-https://github.com/sidecars/python-quickbooks
-https://developer.intuit.com/app/developer/qbo/docs/develop/authentication-and-authorization
Check out the fo_qbo repo. You need an Intuit developer account and (perhaps obviously but for the avoidance of doubt, Admin-level access to a QBO comapny instance) to use it.

Flask-Dance for OAuth

I am relatively new to programming, and have been learning about OAuth2 with Python. Specifically, I have been learning how to use Flask-Dance, beginning with its implementation for Google authentication. I am wondering:
1) Which Google API does Flask-Dance make use of? I see that the default scope in F-D is 'profile', but I can't seem to figure out what other scopes are available
2) What is the difference between the Google API Explorer and the Google OAuth2 Playground? When/why would I use one over the other?
Any help would be appreciated.
Thanks!
1.) Flask dance makes use of OAuth. Oauth is used specifically for allowing users to give authorization to your app or for authenticating users with the OpenID standard. What this means is, say, you want to get data from a user's google account, e.g. you want a list of their google contacts, you'll use OAuth to get authorization from that user. Another use case is if you want to let users login to your application using google. You'd use Oauth for that. In this case you'll be dealing mostly with access tokens and authorization codes, this is what Flask Dance is for.
For more information on OAuth, here's a video that explains it and its various use cases in plain English: https://www.youtube.com/watch?v=0VWkQMr7r_c
2.) The Google API is for a completely different use case. You're not trying to get data from a user's google account and you're not trying to let users login to your application with google. You want to simply use a Google service on your application. For instance you want to use Google Maps in your app so that you can let users of your app get directions to a place. In this case, you'll be working with API keys that identify your application.

Weibo API auth error

I started to write a project for Sina Weibo and got a problem from the start.
When I make a get request to API:
http://api.t.sina.com.cn/statuses/public_timeline.json?source=App_key&count=5
I get an error of authentication such as:
{"request":"/statuses/public_timeline.json","error_code":"403","error":"40070:Insufficient app permissions!"}
or another request and answer:
https://api.weibo.com/2/statuses/user_timeline.json?source=Appkey&trim_user=1&count=100&screen_name=michael
{"error":"applications over the unaudited use restrictions!","error_code":21321,"request":"/2/statuses/user_timeline.json"}
Can someone help me to make this request work?
I just don't het If I need to send token somehow or secret-key.. I am new at development and would be glad if someone answers.
Probably to late, but for future uses. Weibo requires all request to be OAuth2 authenticated. So before using that you need to give permissions and generate access tokens. It's common practice. Services like twitter provide smaller limits also for unauthenticated users, to ease developer live, however that's not the case with weibo :(
If you are working with weibo I highly recommend this article ->
https://www.cs.cmu.edu/~lingwang/weiboguide/

How to tweet from GAE

I want to be able to Tweet from my app running on GAE.
Please suggest some Python library or HTTP API for the purpose.
About python-twitter: I think you can use this lib it seems to be compatible with GAE: http://code.google.com/p/python-twitter/source/browse/twitter.py
Also:
Twitter has a very great REST API https://dev.twitter.com/docs/api, You can also to simply use urlfetch and simplejson from appengine.
For authentication Twitter uses OAuth and recommend to understand how it work:
Twitter supports a few authentication methods and with a range of
OAuth authentication styles you may be wondering which method you
should be using. When choosing which authentication method to use you
should understand the way that method will affect your users
experience and the way you write your application.
Twitter share a very great how to https://dev.twitter.com/docs/auth/oauth
You can also see the part of code: http://code.google.com/p/jaikuengine/source/browse/trunk/oauth_client.py from jaikuengine.
This project worked for me: https://github.com/tav/tweetapp/blob/master/standalone/twitter_oauth_handler.py
It's only one file so it's easy to get it started and uses OAuth for authentication with twitter.
I have used twython in the past. I can't remember what made me select it over other libraries but I was using it on GAE and it is kept up-to-date.
You might find the Tweet Engine project of interest. It demonstrates quite simply how to use the Twitter REST API from App Engine.

use python / django to let users login to my site using their google credentials

I want to let users use their google account to login to my website. Exactly the way SO lets me. Can anyone please point in the right direction? I'm assuming the oAuth library is to be used but what I'd really like is a snippet of code I can directly copy paste and get this to work.
It's not OAuth particularly that you need (OAuth is for authorising access for one website to specific private content held on another), but OpenID - which is meant for authentication rather than authorisation. (Some sites, like Twitter, do provide authentication services via OAuth, but that's not what it's primarily for.) I have used python-openid which is fairly straightforward to use, or you can look at django-openid - though it admits to being incomplete, you could get some idea of how to implement OpenID support.
The problem's a little too involved to admit a copy-and-paste solution, but it's not especially hard to do this.
Update: piquadrat's link (in he comment) is definitely worth following.
You may want to check out django-piston which is a mini-framework with oAuth built in. Here's a tutorial on how to set it up.
You might consider using Django-Socialauth, as it supports
Twitter
Gmail
Facebook
Yahoo (essentially openid)
OpenId

Categories