soundcloud api python user information - python

Issues using SoundCloud API with python to get user info
I've downloaded the soundcloud library and followed the tutorials, and saw on the soundcloud dev page that user syntax is, for example /users/{id}/favorites.
I just don't know how to use python to query user information. Specifically, i would like to print a list of tracks that a given user liked, (or favorited, but liked would be better).
any help would be greatly appreciated. thanks!

Generally, It's better to mention what you have tried and show some code. It makes it easier for people to help you on Stack Overflow. Regardless maybe looking at SoundCloud's Python wrapper will help you.

You can also do the following :
import soundcloud
token= 'user_access_token'
client = soundcloud.Client(access_token=token)
user_info = client.get('/me')
user_favorites = client.get('/me/favorites')
user_tracks = client.get('/me/tracks')
and so on...

I figured it out, pretty simple just didn't know the exact syntax.
users = client.get('/users', g ='keyword')

Related

Make automation in Skype using Python [duplicate]

I need to mention particular user in the message that I sent to a group in Skype. I can send the message easily with the skpy but can't figure it out how to mention someone in the message.
sk=Skype("userid","paasword")
SendMsgTo=sk.chats["group-id"]
SendMsgTo.sendMsg("hello")
there is this sendRaw() thing in skpy which I think I'll have to use, but can't figure it out how to use.
I am new to python and finding my way through the google and the great community of stackoverflow and the similar. So a little help will greatly be appreciated
You can use
SendMsgTo.sendMsg('<at id="8:USER_ID">USER_NAME</at> ', rich=True)
also, if you don't know USER_ID use the SendMsgTo.userIds to find all USER_ID in the group

Python Amazon Simple Product API: 400 Bad Request

So I read a couple of posts already regarding this topic and tried some things they mentioned to do to no avail. I am fairly certain I have correctly given my account permission to API calls, but that wasn't the problem. I saw something about signing a request to an AWS search, but I'm not quite sure if that's it or how I would even do it.
This is the code I have.
from amazon.api import AmazonAPI
def get_amazon_link(item):
amazon = AmazonAPI('...AmazonKey', '...SecretKey', '...AssociateTag')
try:
product = amazon.lookup(ItemId='B00GDQ0RMG')
except Exception as e:
print e
print product
Right now the item I'm passing the function is hard coded just to try and get it working. If anyone could help me out that would be awesome.
Make sure you pass the correct region for which your account is registered. More info here.

AIML - Parsing user inputs as variable to Python

I am working on an AIML project for leisure and came across pandorabots. I was wondering if there is a way to parse a variable from the user inputs into other languages (in this case python) or framework so that we can do further manipulation through other third party API by means of any templating?
For instance, I want to obtain a date from the user and then feed it into the google calendar API. Is there a way to extract the 'date' variable and parse it to google calendar API in Python (or any other languages)?
<category><pattern># 1 MAY 2016 #</pattern>
<think>{{ date }}</think> #is there a way to parse "1 May 2016" as a
#variable date in python?
<template>...
</template>
</category>
Ultimately, the goal I am trying to achieve would have a conversation something like this:
User: Hi bot, could you check if I am available on 1 May 2016?
Bot: Nope, you have a gathering at Mike's! #(<--- Response rendered after
checking user's schedule on 1 May via google calendar )
I explored templating engine like mustache but apparently it does not talk to AIML (or rather xml). Is there anyone who can point me to a good example/tutorial that can help me get started?
ps: I'm using pandorabots API and python2.7
In the pyAIML API, look for the keyword "predicates":
kernel.getPredicate('date')
kernel.getBotPredicate('dat')
it returns the predicate that was set using
<set name="date"><star/></set>
Then you can easily parse it with python.
But that brings me closer to the question: what do I need AIML for? what's AIML's added value here?
I was also looking information for such similar question. With the help of the answer provided by #Berry Tsakala... I was able to find a solution to my problem. Here is a detailed and improved version of the above example case...that might be useful for others having the same question...
<category><pattern>Hi bot, could you check if I am available on *</pattern>
<template>Let me check your schedules on <set name="date"><star/></set>
</template>
</category>
Then in your python script you can store it into a variable as,
import aiml
kernel = aiml.Kernel()
kernel.learn("std-startup.xml")
kernel.respond("load aiml b")
while True:
try:
kernel.respond(raw_input("Enter your message >> "))
appointment_date = kernel.getPredicate('date')
print appointment_date
Feel free to make any corrections to the answer if you find any errors, or if it needs any improvements. Hope you find it useful :)

How to get thread title using praw?

I'm using praw to write a bot for reddit. I already know how to use the get_comments() function to get all the comments in a subreddit. However, I would like to get the titles of all the posts in a subreddit, however, after going through the docs for praw, I could not find a function which does so.
I just want to go into a subreddit, and fetch all the titles of the posts, and then store them in an object.
Could someone tell me how I go around achieving this?
import praw
r=praw.Reddit('demo')
subreddit=r.get_subreddit('stackoverflow')
for submission in subreddit.get_hot(limit=10):
print submission.title
This information is available in the PRAW documentation.
Seems pretty late but anyways you can go through the official reddit api JSON responses format. From there you can see all the attributes that are available to you for a particular object.
Here's the github link for the reddit API
Edit: You can also use pprint(vars(object_name))

python-otter documentation

I want to collect old tweets for a specific period. I have found out that topsy provides the Otter API to do that. I am developing in Python so I found the python-otter API http://otterapi.googlecode.com/svn/trunk/. However, there is no documentation and I have no idea how to use it! Does anybody know if there is any documention at all. And btw is there another way I can find old tweets programatically?
Thanks
The documentation can be found in http://code.google.com/p/otterapi/wiki/Resources
Why not directly make GET requests using urllib2 and the like??

Categories

Resources