Hi,

I am following the instructions from this post to run Python in R:

But when I try to run the following code:
search_tweets_api:
account_type: premium
endpoint: https://api.twitter.com/1.1/tweets/search/30day/Testaroo.json
consumer_key: xxxxxxxxxxxxxxxxxxx
consumer_secret: xxxxxxxxxxxxxxxxxxx

I get this error:
Error: invalid syntax (, line 1)

Everything leading up to that worked. But then I can’t authenticate. I am super new to this. Been at it for a while and just want it to work. Any help is much appreciated!!

That part is for creating a new file called secret.yaml - not R commands to run.

You can use any text editor to create it, but be sure to preserve the spaces - copy paste it as is and only change the keys. Save it in the same directory as the r script.

I’d also make sure your OS has the “show extensions” option turned on so you don’t accidentally create the file as secret.yaml.txt as would happen by default.

Wow, I feel so stupid. Thank you so much!!

I can’t count the number of times i’ve got caught out by YAML. All the time - the spaces in the text are part of the syntax, and must be consistent and windows annoyingly hides extensions by default, and on linux file names are case sensitive too, so there’s plenty of room to make mistakes :joy:

Haha, there sure is! To be honest, when I took on this project, I was not expecting it to be this hard. But I wanted to learn how to use R and Python eventually so it works out. Anyway, thanks, again, so much for your help!

2 Likes