[R-pkg-devel] Help with making a package for Twitter Authentication

Robert M. Flight rflight79 at gmail.com
Fri Nov 20 18:11:41 CET 2015


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 <tushar.sadhu08 at gmail.com>
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 at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list