[R] TWITTER API environment variables

Patrick Connolly p_conno||y @end|ng |rom @||ng@hot@co@nz
Thu Apr 9 01:00:29 CEST 2020



Apart from allowing the twitter app access, I didn't do anything to
adjust the settings other than editing the ~/.Renviron file which set up
the environment variable/s.

It appears to me that they are appropriate since they work if I use R
from the bash prompt or Rstudio.  The problem is apparantly with ESS.
I really don't want to use Rstudio.  It's so clunky to edit and debug
functions, and of course, the bash CLI is even more clunky.

I'll ask on the ESS list.



On Wed, 08-Apr-2020 at 12:32PM +0300, K. Elo wrote:

|> Hi again,
|> 
|> ok, I see. How about repeating the steps described in the tutorial on
|> your second computer instead of cloning the settings from the computer
|> #1? There might be some other settings not correctly copied.
|> 
|> HTH,
|> Kimmo
|> 
|> ke, 2020-04-08 kello 19:02 +1200, Patrick Connolly kirjoitti:
|> > Hello Kimmo,
|> > 
|> > Yes.  I did that and it worked fine -- as far as it goes.  But it
|> > didn't cover what to do when using the same twitter account on a
|> > computer with a different user name -- which is what my question was
|> > about.
|> > 
|> > 
|> > On Wed, 08-Apr-2020 at 08:55AM +0300, K. Elo wrote:
|> > 
|> > > > Hi!
|> > > > 
|> > > > Have you already read this:
|> > > > 
|> > > > 
|> https://cran.r-project.org/web/packages/rtweet/vignettes/auth.html
|> > > > 
|> > > > I think they explain rather well how to use Twitter tokens with
|> > > > rtweet...
|> > > > 
|> > > > HTH,
|> > > > Kimmo
|> > > > 
|> > > > ke, 2020-04-08 kello 17:19 +1200, Patrick Connolly kirjoitti:
|> > > > > I'm using the rtweet package which makes use of the Twitter API
|> > > > > which
|> > > > > requires a token alluded to by an environment variable.
|> > > > > 
|> > > > > That environment variable is automatically set up from the
|> > > > > Twitter
|> > > > > web
|> > > > > site and takes the name TWITTER_<username> (where <username> is
|> > > > > the
|> > > > > name of the user in block letters).  That worked fine on my
|> > > > > work
|> > > > > computer where my username is 'work'.  When I copied that
|> > > > > working
|> > > > > directory to my home computer, the environment variable became
|> > > > > TWITTER_HOME but the rtweet package was looking for
|> > > > > TWITTER_WORK. There was no error message: just a null result
|> > > > > from the
|> > > > > search_users() function.
|> > > > > 
|> > > > > I tried editing the ~/.Renviron entry to
|> > > > > TWITTER_WORK=/home/home/.rtweet_token.rds
|> > > > > 
|> > > > > That worked for a short time but soon ceased working.  Then I
|> > > > > noticed
|> > > > > a new entry had been automatically added to ~/.Renviron
|> > > > > 
|> > > > > TWITTER_HOME=/home/home/.rtweet_token1.rds
|> > > > > 
|> > > > > So now I had two environment variables which also worked for a
|> > > > > short
|> > > > > time.
|> > > > > 
|> > > > > Recommendations please.

-- 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
   ___    Patrick Connolly   
 {~._.~}                   Great minds discuss ideas    
 _( Y )_  	         Average minds discuss events 
(:_~*~_:)                  Small minds discuss people  
 (_)-(_)  	                      ..... Eleanor Roosevelt
	  
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.



More information about the R-help mailing list