Google feed Api - rss

So, basically this is what I want to do. A, building a mobile news applet that will connect to a server running Java/Python to get news items. The server connects to a news site which has rss feeds. Note: the site is not mine.!
Questions
1. Can I use google feed api to read the sites feeds?
2. If so, I need a short abstract description of how to go about it(I can't understand what google have written about it.)
N/B: Am a newbie, so please keep explanations basic.

yes you can.
import urllib2
import simplejson
url = ('https://ajax.googleapis.com/ajax/services/feed/find?'+'v=1.0&q=Official%20Google%20Blog&key=INSERT-YOUR-KEY&userip=INSERT-USER-IP')
request = urllib2.Request(url, None, {'Referer': /* Enter the URL of your site here */})
response = urllib2.urlopen(request)
Process the JSON string.
results = simplejson.load(response)
now have some fun with the results...
http://code.google.com/apis/feed/v1/jsondevguide.html#json_snippets_python
after we have "results" its just a matter of processing a JSON format response. cant get simpler than this.

Related

Lua - Capture the redirect URL and provided parameter information

I’m trying out the Fitbit api, to learn about about OAuth 2.0, and the authorisation code i need in the process is something fitbit provide, appended to a domain name I provide.. (More specific details are here - https://dev.fitbit.com/build/reference/web-api/developer-guide/authorization/ )
Here’s an example of a redirect URL that’s you’re taken too to get an authorisation code.
https://myapp.com/callback?code=d62d6f5bdc13df79d9a5f#_=_
And it’s the d62d6f5bdc13df79d9a5f part of that new page/URL which I need..
Is it possible with Lua to capture the redirected URL that fitbit issue?
Please consider me a mere novice/intermediate with Lua, so go easy on me. :-). Thanks is advance…

How to make a request to a site with reCAPTCHA with Python Requests

Goal
I want to make a request to a website with Python requests to scrape some information for containers location and time.
This is the website I'm trying to get data from : https://www.cma-cgm.com/ebusiness/tracking by inserting the container number.
I'm trying something simple, like :
import requests
url = "some_url_i_cant_find"
tracking_number = ABCD1234567
requests.post(url, payload=tracking_number)
Problem
I cannot find in the Network tab how the request to get the container's data is being processed.
I assume this has something to do with reCAPTCHA, but I don't know much about this or how to handle it.
Solution
Some other answer or topic regarding this issue
How to make a request to this website and read the response.

What will the RightSignature API send to my callback URL when a signer signs a document

When I send a one-off document to RightSignature via their API, I'm specifying a callback location in the XML document as specified in RightSignature's schema definition. I then get a signer-link value back from their API for the document. I display the HTML response from the signer-link URL in an iFrame on our website. When our user signs the document in this iFrame, which is rendering the responses from their website, I want their website to post to our callback location.
Can I do this with the RightSignature API and does it make sense?
So far, I'm only getting content in the iFrame that indicates that the signing was successful. The callback location does not seem to be getting called.
I got it solved just now. Basically, i was doing two things wrong first you have to go in RightSignature Account and set it there the CallBack url
Account > Settings > Advanced Settings
But the thing which RS is unable to mention to us that this url can not be of localhost, but it should be of https i mean like Live URL of your site like
https://stagingmysite.azurewebsites.net/User/CallBackFunction
And then in your CallBack just write these two lines and you will receive complete XML which would have the GUID and document status as well.
byte[] data = Request.BinaryRead(Request.TotalBytes);
string callBackXML = System.Text.Encoding.UTF8.GetString(data);
I found the answer with some help from the API team at RightSignature. I was using callback_location but what I really wanted is redirect_location. Their online documentation was difficult to follow and did not clearly point out the difference.
I got this working after a lot of trial and error.

How to make POST request using OAuth via Youtube API?

I am trying to get this thing to work for a couple days since it's my first time working with the OAuth system without any luck.
I have been experimenting here: https://developers.google.com/youtube/v3/docs/subscriptions/insert#try-it
With the following settings:
http://i.gyazo.com/5cd28f1194d5dfebee25d07bc0db965e.png
When I execute the code it successfully subscribes to the specified channelIdaccount with the authorized account.
I have tried to copy paste the shown POST URL into my browser without any luck. The plan was just to test it as I would like to implement this in PHP.
Now to my questions:
The {YOUR_API_KEY}, is this where I am supposed to type in the access token? If so, do I need the &mine=true tag at all?
I just realized that there are no ID's in the URL but there is an JSON-object in the request box example. Am I supposed to convert a string to JSON-object and pass it to the $fields= tag?

HTML scraping using YQL

I am trying to use YQL to scrape some websites. When I test various queries in the YQL console I get an results node. So for example when I run:
select * from html where url="http://www.reverbnation.com/" and xpath='/html/body'
I get an empty <results /> node (permalink).
Thanks in advance!
http://www.reverbnation.com may be blocking the request coming from Yahoo! based on certain criteria, like headers. I had a look at reverbnation's robots.txt, and they aren't blocking Yahoo! based on the "Yahoo Pipes 2.0" user agent, so it must be something else.
To re-create the issue, make a YQL query against your own site, then look at the full access logs to see the full request and all headers that came from Yahoo! Then make a similar request using a tool like cURL.
You can also try and run netcat on a port and query with http://yoursite.com:PORT to see the full request.
Related issue discussed here.

Resources