google cloud print post - google-chrome

I'm trying to ultimately silently print using Google Cloud Print from a POST function that is called from code on a website.
I succeeded in testing cloud printing using my account and my printers using a form submit.
(you can see the code that worked for that here: https://stackoverflow.com/questions/23975931/programatically-change-file-name-in-google-chrome-print)
The form submit didn't ask me for any authorization that I could tell. It asked me for xsrf. I stumbled across the answer for this by testing here:
https://www.google.com/cloudprint/simulate.html
So my question is can some amazing person please take pity on me and post the entire code for POST to submit a print job to GCP INCLUDING the format for authorization and where I get that info?
I have read the manuals for cloud printing and the info on how to get an oauth (although I don't understand that part yet)
I am missing something that will be obvious to people who have done this before.
I have tried the php code at github - although I do not usually code in php.
I have programmed a lot of API's and there is something I am just missing here.
Thank you profusely in advance!

i developed this simple library in python. https://github.com/escube/GoogleCloudSpooler
You cna use as you wish.
I developed a server version as well, but the lib used is the one in this project.
Try to use it and tell me if you have problem with that, I'll be pleased to help.

You could try using an alternative service such as PrintNode which has an excellent API and is very simple to use.

Related

Program/tool for reading/logging http requests and responses?

I'm trying to log autocomplete responses from a gmail "people" server, and I'm trying to find a program or tool to do this, like the network section in chrome dev tools. I tried using a web crawler script, but authentication would be a mess. I also tried Wireshark, but it was all garble to me and probably the wrong way to go. Is this even possible? Can somebody help me, I'm totally out of my comfort zone here. please see attached image
It would be best to find an API that google makes public for the data that you need and use that to query the data. For people, google does have an API. Have a look here: https://developers.google.com/people
Tools commonly used to make HTTP queries are https://www.postman.com/ and https://curl.haxx.se/

Requested entity was not found. [404]

I hope someone has some insight into this issue. I'm trying to execute script in google sheets. The script runs fine when manually executed. We need to use service account for this purpose. API executable was published, I have .p12 file for authentication, there is only 1 function to run and we're getting the 404. I'm using some c# code from DEVs site and that should work as per the article. Has anybody else run into this? Is there an example that shows how to do it correctly? This is what i've based my code on, to no avail... https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth
Thanks for any ideas!
Edit: Thanks Ares - my specific problem is that while following devs example code, I can't execute google script and receive the before mentioned 404 error.
You cannot use C# in GAS. Google Apps Script is based on Javascript. The link you provided shows how to code an example in .NET, which is neither GAS or C#, so I'm confused at why you would follow that example at all.
Regardless, any code that can be used in a Google Script site will say that it is for a .gs or an HTML file.
Remember that Google has many API's that work across multiple languages. GAS is what they want to push, but not every guide they make is aimed at GAS.
I assume the 404 is from using unreadable code.

Transform Old Google Spreadsheet Code

I used this code to insert documents directly into a Google spreadsheet without having to upload files and then create hyperlinks. However, as google moved to the new spreadsheet...
Warning: The UI service was deprecated on December 11, 2014. To create user interfaces, use the HTML service instead.
So know I need help fixing lines like; var app = UiApp.getActiveApplication();
If someone could clarify the different types of programming direction you could take this project from, that would also be very helpful, I am not really sure if I need to work with Javascript or HTML now.
The answer to your question will depend in large part on how you are using UIApp. In most cases it's not as simple as changing a few lines of code but more of a script redesign.
If you are using it to create a custom user interface, your path forward would be to rebuild your interface as HTML/Javascript and serve it to the user with HTMLService. The service is overall much more powerful/flexible and provides a better end-user experience but it means rewriting how your script works. If you want to take a look at a helpful example on how the HTML Service works take a look at the HTML Service Guide or this quick-start example of an add on.
You can still link this html interface with your script using the google.script.run service but you will need to redesign your code/application to work with the new input methods. The good news is although UI service will sunset on June 30, 2015, "Service will no longer appear in autocomplete, although existing scripts should still function."
It's worth considering alternate ways to accomplish the same goal. The best way to do that is to start by asking "What is the intended use of this script? What problem does it solve?" There may be a better way to accomplish that task which may not even involve updating the script.
This is not related to the new spreadsheet version, the message you get is because UiApp has recently been deprecated.
A Google search would have shown you a few tracks to find your way.
One of the best I found is this one from Sandy Good : Google apps script UI services to HTML services
It shows a typical example of conversion to HTMLService.

Using Github login with a Django project

I'm working on making a site that allows login with Github and I'm using Django for this. I've gotten as far as redirecting the user to the github authorization page, and then redirecting the user to another part of my project after successful authorization. My question is then: How do i extract such things as the users username and other values? I imagine that a JSON object is sent to me, but how do I use it and where do I get it? I have never done anything like this before, so it might be obvious but if anyone could help me it would be appreciated. Bear in mind that I'm a newbie in Django.
Github login is just OAuth. There is full documentation on Github's dev site on how to do it manually, but you probably want to use one of the many Python libraries which make the process easier such as python-social-auth or django-allauth.
Check out:
https://developer.github.com/guides/basics-of-authentication/
But there is package with this functionality:
python-social-auth

How to use Telegram API in Windows Phone 8?

I would like to use Telegram API for Windows Phone 8. Though unlike other platforms, Telegram doesn't provide source code for Windows Phone. This is unfortunate because it creates a lot of problems for those who want to use it. From my research people mention using REST Service to accomplish that. Though no one showed any exact solution for how to accomplish it. I also read about using RPC calls to accomplish it. I don't know how to do that and I would greatly appreciate someone who could explain step by step to how to implement Telegram in ones app. Big Thanks!
If you need to see source code of an app using the Telegram API you should take a look at github.
There are a lot of apps there using this API:
API, Protocol documentation
Documentation for Telegram API is available here: http://core.telegram.org/api
Documentation for MTproto protocol is available here: http://core.telegram.org/mtproto
Take a look at this one https://telegram.org/apps#telegram-for-wp
You can browser their source code there downloading the zip. Unfortunatelly Stackoverflow does not permit we post a step by step walkthrough of using an API.