I have cut and pasted a python code sample from Google API to access You Tube video viewing data of my companies videos. The application will be scheduled and get usage data then write to a database on the server ( CENTOS ). I have tried both Simple API and installed application types. Is there a solid samle type that you know of or anyone else having issues with the API calls? My latest error is that the JSON file is not organized correctly ( which I got from the API page unaltered ).
Most google api code snippet require the user to input their personal API KEY. Please be sure you have appropriately updated the code snippet to use your api key.
Related
i am trying to use the requests library with python to fetch data from the traffic api with python.
this is the link for website with api that should include the traffic data:
https://api.tomtom.com/traffic/services/4/flowSegmentData/relative0/10/json?point=52.41072%2C4.84239&openLr=true&jsonp=jsonp&key=3EeqxQCR2DNsYzRCT0RPIxUhlzAM3hQc
but it returns an "Developer Inactive" on the website . how to solve that and use the api
also i want to ask if this will work with kivy.
API request that you provided has an API key that is not existing anymore. I tried it with your API key that you provided in the comment and it worked. But you must notice that you copied it wrongly - there is an additional character at the beginning.
I am building a python script that is trying to stream a screen capture to my Facebook Page and to be able to retrieve all the comments from the Facebook Live stream real time so that I can do some processing in the middle of the stream.
The Facebook App was set up (in development mode) but when I tried to retrieve the comments from my live stream, I am only able to retrieve comments with their name and id ("from") that are made as the Facebook Page Admin, not comments that are made by other users. I need the user's id, user's name and their comments.
I understand that I need to get Facebook App to be live mode in order to retrieve all the comments with their details tagged to it. When I tried to get it, it tells me that I need to get the permission approved. I tried to fill in most of the stuff and try to get the two permission (manage_page for the comments and live video API for the streaming) but I was unable to because I left the platform empty.
Below is the message I got:
You do not have any platforms eligible for review. Please configure a platform on your Settings page.
The problem is when I tried to choose a platform that was shown in the list, python script does not fall in the list of platform.
Does anyone know of a solution or a different way to achieve what I need to retrieve?
Have you tried using PyLivestream?
It can be used to stream to Facebook Live using FFmpeg (to multiple services simultaneously actually, like Periscope, YouTube etc).
It adheres to the RTMPS requirement and should be an option for you if I interpret your needs correctly.
python -m pip install PyLivestream
Facebook Live
Facebook Live requires FFmpeg >= 4.2 due to mandatory RTMPS
configure your Facebook Live stream
Put stream ID from https://www.facebook.com/live/create into the file facebook.key
Run Python script for Facebook with chosen input
Check out the PyPi PyLivestream page for details.
To be able to retrieve all the comments from the Facebook Live stream
I'm not sure if this is possible using PyLivestream alone, but the Polls API can be used to represent VideoPoll objects in the Graph API, to create polls on live video broadcasts and get real-time responses from your viewers and can be created with the
POST /{live-video-id}/polls
endpoint on a LiveVideo object.
Upon creation, the API will return a VideoPoll object ID, which you can use to manipulate the poll and query for viewer interactions.
Guess you'll have to do a bit of digging to figure out the details,
but I believe this would be the right way to approach this task.
In order to get the "from" field when retrieving the comments, you need to have manage_pages permission from your Facebook App that is linked to your Facebook Page. You will need to submit an App review for your Facebook App that usually takes 1-3 days to process. If you are lucky, it will probably take about 6-8 hours.
Once it is approved, you can request the permission and get your application to go live.
Also use the Page Access token in your "access_token" field when invoking the API so that it will allow you to pull the "from" field, which contains the id and name of the user.
I'm working on an app which wraps Google Docs (using GAE/Python), and I want to keep track of who is viewing these docs in real-time. I can't find any APIs for this in the Google Drive SDK.
What's a good way to do this? Naively, I might imagine repeatedly polling each document individually and parsing the returned HTML. I expect there to be ~150 docs total in the system; would this be too inefficient?
Realtime api is not for using with gdocs, only for your own custom formats. Instead see the changes api in drive but you wont be able to detect viewers only modifications https://developers.google.com/drive/manage-changes
I am not sure if this meets your requirement but there is a Realtime API available in the Drive SDK.
The catch is that it is JavaScript only. It does have Events that your web client can be notified off like CollaboratorJoinedEvent and CollaboratorLeftEvent.
I am making a web application that will monitor the amount of members and discussions in each one of the groups listed here (http://www.codecademy.com/groups#web) and display that information in nice graphs.
However, as you have already seen, it looks like I need to create an account and login with it.
Having in mind that my project is using Python for the server side, how do I do it? Which API is easier? (Google, FB or twitter?)
I would really love if you could also provide some examples because I am really new at this (and at Python too).
The official wrapper around the Twitter API for Python is this one. I used it and it's very easy. You should first read this page and also register an application to get OAuth keys.
Example:
import twitter
# Remember to put these values
api = twitter.Api(consumer_key="",
consumer_secret="",
access_token_key="",
access_token_secret="")
# Get your timeline
print api.GetHomeTimeline()
Hope it helps.
I had an application running on GAE which accessed twitter Search API. However recently twitter has moved to the new version 1.1 and previous version of api is no longer functional. And I'm having trouble accessing the new API.
Basically I wanted to get tweets matching a search query and I simply accessed the url using python code and got all the data in json format. The url I accessed (which is not working now) is:
http://search.twitter.com/search.json?q=query
Instead I searched and found out that the equivalent url in new API is probably:
https://api.twitter.com/1.1/search/tweets.json?q=query
However if I just access it simply like I did before (just fetching the url and accessing the contents) then it gives an error and apparently I need to authenticate my request by obtaining some oauth credentials and using them with the request.
I tried searching of how to do that if there is another method beside just fetcihng the url contents, but in vain. I'd really appreciate if someone could help me out, and if possible give some sample python code. Thanks!
New Twitter API needs user authentication, meaning that each user visiting your site will need to go through auth procedure. This makes new Twitter API much less useable.
See this answer for details how to use OAuth on GAE/Python.