Integrating Yahoo Sports API Data - r

I have been following the code from here, which works until the "yahoo_token" step that yields the following:
yahoo_token<- oauth2.0_token(yahoo, myapp, cache=T, use_oob = T)
Please point your browser to the following url:
https://api.login.yahoo.com/oauth/v2/request_auth?client_id=dj0yJmk9Uk1waEVUSWNhQmF1JmQ9WVdrOVpXNUNTelZDTnpZbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD04OA--&scope=&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code
Enter authorization code:
I then have no idea what the authorization code is. The link they ask me to point my browser to also asks for a code but none was provided to me at any point during this process.

I was able to solve this after changing my request for authorization to:
yahoo_token<- oauth1.0_token(yahoo, myapp, cache=T)

Related

LocustIO: How to do batch request

I started to use LocustIO for load testing a 3rd party API which provides a way to do batch requests (http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_BatchRequests).
How can this be done using LocustIO?
I tried with the following:
def batch(self):
response = self.client.request(method="POST", url="/$batch", auth=("ABC", "DEF"), headers={"ContentType": "multipart/mixed; boundary=batch_36522ad7-fc75-4b56-8c71-56071383e77b"}, data="Content-Type: application/http\nContent-Transfer-Encoding: binary\n\nGET putyoururlhere HTTP/1.1\nAccept: application/json\n\n\n")
Auth is something I need to have authentication to the API, but that's not the point of the question and "putyoururlhere" should be replaced with the actual url. Either way, it gives errors when executing the test, so I must be doing something wrong.
People with experience how to do this?
Kind regards!
The data parameter should be your POST body (only), you cant put additional headers in it the way you did. You probably just want to add them as additional entries in the dict you pass as headers
Se the documentation for python requests library for more details. https://requests.readthedocs.io/en/master/

Scraping login protected website with a challenge form?

I'm trying to do some web scraping from steamspy.com, specifically the total playtime hours for a certain game. That info is behind the login wall for the site, so I've been trying to figure out how to get R past it for html mining.
I tried this method for passing login credentials via POST() but it doesn't seem to work. I noticed that the login handler for that example used POST, whereas looking at the source code for steamspy it seems to use a challenge form and I wasn't sure how to proceed with R.
My attempt thus far looks like this:
handle <- handle("http://steamspy.com")
path <- "/login/"
login <- list(
jschl_vc = "bc4e...",
pass = "148..."
)
response <- POST(handle = handle, path = path, body = login)
I found the values for the jschl_vc and pass from inspecting the source code after I logged in. The code above doesn't work and gives me:
Error in curl::curl_fetch_memory(url, handle = handle) : Failure
when receiving data from the peer
probably since I'm tryign to use POST to a challenge form. Is there way that I'm missing to proceed?

Log in to website using Jsoup

I'm trying to scrap a webpage for data but came across the problem of needing to log in.
Connection.Response loginForm = Jsoup.connect("http://www.rapidnyc.net/users/google_login")
.method(Connection.Method.GET)
.execute();
Document document = Jsoup.connect("http://www.rapidnyc.net/users/google_login")
.data("Email", "testEmail")
.data("Passwd", "testPass")
.... //other form data
.cookies(loginForm.cookies())
.post();
This gives me the org.jsoup.HttpStatusException: HTTP error fetching URL. Status=400
I used chrome developer tool to look at the Form data being posted but nothing I post works.
1. Have you submitted ALL input fields? Including HIDDEN ones.
2. I see the website requires "captcha-box" authentication, which is to prevent web crawlers from logging in. I highly doubt you will be able to log in with your program.
I say the 400 status is coming from your program not being able to provide the value for "captcha" authentication.

trouble with example google maps code

executing this:
$curl "http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false"
returns this:
{
"results" : [],
"status" : "ZERO_RESULTS"
}
Why doesn't it work?
Cheers!
Not sure, but I get the same results when I hit that URL directly in the browser. It may have something to do with that being the sample address that is shown in Geocoding Responses section of the Google Maps API Web Services Dev Guide. Maybe they turned it off because it was getting overloaded?
I even tried a version of that address that has been URL encoded:
http://maps.googleapis.com/maps/api/geocode/json?address=1600%20Amphitheatre%20Parkway%2C%20Mountain%20View%2C%20CA&sensor=false
but get the same result as the original attempt.
I can tell you that if you go directly to http://maps.google.com/maps and key in: 1600 Amphitheatre Parkway, Mountain View, CA, you do get results.
At any rate, your URL is basically formatted correctly and should work. Try a different address, formatted the same way, and you will get results. This worked fine for me:
http://maps.googleapis.com/maps/api/geocode/json?address=Wrigley+Field&sensor=false
Some follow up, I'm not sure where you were trying to run your code, but if it was in a jsFiddle, you may be interested in this question: JQuery won't get json?

How to integrate Payseal in ASPNET

Anyone, plz, provide me the details of integrating payseal(ICICI) in my website.. They hav given some testing code.. But, I couldn't understand it.. If I get any code sample, it will be useful for me.
Thanks in Advance
Ok..I found the solution.. Just add the dll which is provided by them. They hav given the sample test pages. In that, run the aspx file, "testssl.aspx" by changing the function setmerchantdetails with your information like merchant id,response page etc., like
objMerchant.setMerchantDetails("00001212", "00001212", "00001212", "", transactionid, "Orderno", "http://localhost/SFAClient/SFAResponse.aspx", "POST", "INR", "INVoiceno", "req.Preauthorization", "1550.00", "GMT+05:30", "Ext1", "Ext2", "Ext3", "Ext4", "Ext5");
That will take u to the icici payseal page. From that the customer hav to response. After finishing the payment, it will directly return to the response page designed by you(http://localhost/SFAClient/SFAResponse.aspx).
Hope, it will help others!!!!

Resources