Re: [R-pkg-devel] Help with making a package for Twitter Authentication
Hey, I am not sure, that this is the right list for questions that are 'only mildly' related to package developement. Your question is more about API/webscraping etc. . Maybe someone can point to a better place to post questions like this?. ... that beeing said ... If I understand your problem right, I would suggest to try out the twitteR package [1] which already has authentication and data retrieval build in. If you do want to do it on your own I would suggest building on top of httr [2] for authentication and HTTP-communication to access information from the official Twitter API [3]. Make sure to have a look at the demo provided on httr's Github repo [4]. Also the httr vignette on how to write API wrapper packages might be useful and last and very least I build a kind of minimal package for reading tweets and tweeting ot be found on my Github [5] which might also be of use because it only implements reading tweets of specific user. Good luck, Peter [1] https://cran.r-project.org/web/packages/twitteR/index.html [2] https://cran.r-project.org/web/packages/httr/index.html [3] https://dev.twitter.com/rest/public [4] https://github.com/hadley/httr/blob/master/demo/oauth1-twitter.r [5] https://github.com/petermeissner/twitterlight Am Do, 19. Nov, 2015 um 5:33 schrieb Tushar Sadhu : > Hello and greetings > > I have been doing Twitter Data Analysis following a few blogs which > requires me to register as a developer and enter a PIN everytime I > want to > start reading tweets. But now I have made a basic package which does > all > the hectic authentication, but the PIN from an authorized app is still > required. > (specifically after twitCred is correctly defined and this step : > twitCred$handshake(cainfo = system.file("CurlSSL", "cacert.pem", > package = > "RCurl")) ) > Though it works and reduces the steps, it still has to go to the URL > and > enter the PIN manually > > So my questions are two : > > 1. If I go ahead with the current method of reading tweets by logging > from > my account, how do I automate the process of entering the PIN when > the code > runs inside the package? > 2. What is the standard method of gathering tweets without any > authentication at all. How is it done professionally without using > anyone's > account and PIN. > > This is my first question here and I am not sure if I am following the > right protocols or am asking silly questions. In either case I am > sorry. > > Please help! > Also Thankyou in advance :) > > Regards > Tushar Sadhu > > [[alternative HTML version deleted]] > > __ > R-package-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-package-devel [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] Help with making a package for Twitter Authentication
Tushar, I've created a Twitter App, and then saved the credentials for that app as an object that is part of an R package, using the four pieces of *api key, api secret, token key, token secret* that you get when you create a new app. I've posted a tutorial here: http://rmflight.github.io/posts/2014/06/r_job_notifications_twitter.html The only thing I've found is that with new versions of some packages I may have to regenerate the object and save it with the package. Note that this method *should only be used with personal packages*, and the credential object should never go into version control! Alternatively, I think there may be a way to read in the four pieces from a text file to generate the Oauth token object that can then be used for the session. This might be a better method for a distributable package, and I'm actually thinking of switching to this method myself, but have not tried it yet. I hope this helps. -Robert On Fri, Nov 20, 2015 at 11:55 AM Tushar Sadhu wrote: > Hello and greetings > > I have been doing Twitter Data Analysis following a few blogs which > requires me to register as a developer and enter a PIN everytime I want to > start reading tweets. But now I have made a basic package which does all > the hectic authentication, but the PIN from an authorized app is still > required. > (specifically after twitCred is correctly defined and this step : > twitCred$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = > "RCurl")) ) > Though it works and reduces the steps, it still has to go to the URL and > enter the PIN manually > > So my questions are two : > > 1. If I go ahead with the current method of reading tweets by logging from > my account, how do I automate the process of entering the PIN when the code > runs inside the package? > 2. What is the standard method of gathering tweets without any > authentication at all. How is it done professionally without using anyone's > account and PIN. > > This is my first question here and I am not sure if I am following the > right protocols or am asking silly questions. In either case I am sorry. > > Please help! > Also Thankyou in advance :) > > Regards > Tushar Sadhu > > [[alternative HTML version deleted]] > > __ > R-package-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-package-devel > [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel