I'm using the google calendar API (python) to do some calendar parsing, and I'm going to be running a script once an hour to download events for the next two weeks. I'm on a pretty old system which has a lot going on so I want to only pull when there has been data changed. Is there any flag within the api to check if there is a change since last read?
Thanks for your time!
You may want to check the Events: watch method which watches for changes to Events resources. Also, from this post, the Google Calendar API provides push notifications that let you watch for changes to resources. You can use this feature to improve the performance of your application. It allows you to eliminate the extra network and compute costs involved with polling resources to determine if they have changed. Whenever a watched resource changes, the Google Calendar API notifies your application.
Related
I would like to automate this process of viewing logs in dashboard and typing the information (Total messages sent in a time period, total errors, CPU usage, memory usage), this task is very time consuming at the moment.
The info is gathered from mulesoft anypoint platform. I'm currently thinking of a way to extract all of the data using python webscraping but I don't know how to use it perfectly.
You'll find here a screenshot of the website i'm trying to get the data off of, you can choose to see the logs specific to a certain time and date. My question is, do I start learning python webscrapping or is there another way of doing things that I am just unaware of ?
Logs website example
It doesn't make any sense to use web scrapping. All services in Anypoint Platform have a REST API. Most of them are documented at https://anypoint.mulesoft.com/exchange/portals/anypoint-platform/. Scrapping may broke with any minor change to the UI. The REST API is stable.
The screenshot seems to be from Anypoint Monitoring. I see in the catalog Anypoint Monitoring Archive API. I'm not sure if the API for getting Monitoring Dashboards data is documented. You could alternatively use the older CloudHub Dashboards API. It is probably not exactly the same but it will approximate.
I have a public Google Calendar link (which I do not manage), and I would like to extract data from it to my python program. (From there I will myself process the data).
Basically, given a url to a public Google Calendar, I want to parse the events. No need to add or delete events, just read the events and their info. I don't see a reason to log in to my Google account because anyone with the url can view said Calendar from their browser with no sign-in needed.
Couldn't find anything on the web that does specifically this. Thanks!
You need to use authentication. There simply is no way around this. There are several reasons for this, but the main one is that the Google Calendar API has usage limits.
If there is no way to identify the account performing the request, you could create an app that spams the API with so much requests you bring down the Google Calendar API for everyone. Attaching authentication to the requests allows Google to track the usage.
You should use a service account created specifically for this. The best documentation about service accounts and how to use them in python is this one.
Combining this documentation for the Calendar API with the one linked above should get you started.
Note, if you are performing a lot of requests, you might hit the limits mentioned above. You will need to use what is called exponential backoff. The principle is described here. If you want to know about why to use a random value, see this nice blogpost on how to shoot yourself in the foot.
I have been trying to utilize Google Drive's REST API to recieve file changes as push notifications, but I have no idea on where to start. As I am new to programming all together, I am unable to find any solutions.
I am using Python to develop my code, and the script that I am writing is to monitor any changes in any given spreadsheet to run some operations on then modified spreadsheet data.
Considering I was able to set up the Sheets and Drive (readonly) APIs properly, I am confident that given some direction, I would be able to setup this notification reciever/listener as well.
Here is Google Drive API Feature Page.
Just follow the guide in Detect Changes
For Google Drive apps that need to keep track of changes to files, the
Changes collection provides an efficient way to detect changes to all
files, including those that have been shared with a user. The
collection works by providing the current state of each file, if and
only if the file has changed since a given point in time.
Retrieving changes requires a pageToken to indicate a point in time to
fetch changes from.
There's a github code demo that you can test and base your project on.
At first I want to find some API, but I have searched on the internet and didn't find anything
really helpful.
"Real time" I mean live stream the stock price on a webpage without a refresh.
If there is not such API, would my following method be a good way to implement this?
1. Python side, call yahoo finance api to get the most recent price.
2. Browser side, use ajax to constantly call server side to get the price and display the price. More specifically, I am thinking to use setInterval in jquery to achieve this.
How does this approach look?
Actually this is not specific to stock price data, any website that need to constantly retrieve data from server side need to consider this problem. For example google chat, facebook news feed, and so on. Can anybody tell me in general how to achieve live streaming data from server to browser?
Another way would be to use a push architecture. You could take a look at APE - Ajax Push Engine.
You could also take a look at Socket.IO, a realtime application framework for Node.JS.
Hope this helps!
You should definitely use a Push API. These days you should probably use http://www.websocket.org/
You don't want to use a rest API for real time, its inefficient to constantly "pull" the live price. Instead you want a service that will "push" changes to you whenever new trades are executed on the exchange. This is done with a websocket, which is a type of API but it is definitely different from a rest API. This article discusses the difference.
Intrinio provides a real-time websocket and you can access it via Python using this SDK on Github. You can access the same data via rest API using this package in Python. If you try them both you will see the architecture doesn't make sense with a rest API.
This video shows the trades coming in- trades don't execute on the market at regular intervals, it's completely sporadic. Instead of constantly "asking" the server for the data, it's better to "listen". This is called top of the book, meaning you get the newest trades as they come in from the top.
Is there a way to query for events in multiple calendars (in the same Google account) in a single batch request?
I've been through the Google documentation here, but it hasn't really helped.
What I'm trying to do really is scan through a given user's calendars and get a list of events for each one.
An example in python/gdata would be amazing.
EDIT: Looks like this answers my question. TL;DR not possible.
Short answer: No
Long answer: The API does not allow you to fetch more than one calendar with a single request and it doesn't allow you to manipulate more than one calendar in a single request.
If this is really important to you (you're trying to reduce requests so I guess it's about performance), you could possible use the Google App Engine to create a function that would perform this work for you. I'm not sure you would see a big jump in performance though.