How can I read email (gmail account) in R - r

I would like to read email received on my google account.
I've tried ‘mRpostman’ package, setting a third party psw for the purpose, as it follows:
install.packages("mRpostman")
library(mRpostman)
con <- configure_imap(url="imaps://imap.gmail.com",
username="xxx#gmail.com",
password="***")
con$list_mail_folders()
then I get this error:
Error in list_mail_folders_int(self, retries) :
Request error: the server returned an error.
Is there a specific setting for gmail that has to be set? I don't find any indication on the documentation page (https://cran.r-project.org/web/packages/mRpostman/mRpostman.pdf), that has been updated on October 27, 2022, so I guess the package is still actively maintained.
Eventually does anyone know another package that I could use for this purpose?
Thanks in advance

Related

Is the package wosr still usable?

I am making a literature review using Web of Science queries. I wanted to use the wosr package to make the queries directly in R but I keep having error messages. I think it is related to the maintenance of the package.
For instance, I used the example given by the package itself:
library(wosr)
sid <- auth(username = NULL, password = NULL)
pull_wos("TS = (dog welfare) AND PY = 2010", sid = sid)
And it returns:
Error: (IIE0022) The SOAP request message is invalid. Reason: Error received from a server supporting the Web service. Cause: The following input is invalid [Not authorized to edition BHCI in collection WOS]. Remedy: Correct your request and submit it again.
Does anyone here knows if the package is still operational? Did someone already used this package? Is there an other alternative to make queries on WoS directly in R?

R- Following Error: API returned: Request had insufficient authentication scopes

I've verified my API in RStudio after hours of trying and now I've reached another error while trying to translate a sentence. Would be grateful for any help!
I'm just trying to translate "hello" to french using googleLanguageR package -
> gl_translate("Hello", "fr")
The result I get is this -
2021-01-21 17:15:36 -- Translating text: 5 characters -
i 2021-01-21 17:15:36 > Request Status Code: 403
Error: API returned: Request had insufficient authentication scopes.
I'm a literal beginner in the field of computing and do not understand what scopes mean here.
Thanks for the help!
Scopes are permissions that you give to apps you use to access an API. For example, one App might have permission to read the private messages of a users, whereas another doesn't. It's similar to when an app on your phone asks for permission to use the camera, or access your contacts.
Your app is trying to do something that it doesn't have permission to do. You'll need to add the relevant scopes in whatever setting that it is where you're generating keys etc. Presumably Google Data Studio?
Okay, I found an answer.
I needed to download a json version of my key and authorize it using the code -
gl_auth("filename.json")
After doing this, I needed to make sure my API is enabled. Now, it is working perfectly!

RLinkedin Connectivity Error

I am trying to use the Rlinkedin package to establish a connection to Linkedin.
I have followed the instructions in Rlinkedin package and r-bloggers link.
My code snippet looks like this (keys are hidden while posting):
library(Rlinkedin)
app_name <- "XXXX"
consumer_key <- "XXXX"
consumer_secret <- "XXXX"
in.auth <- inOAuth(app_name, consumer_key, consumer_secret)
my.connections <- getMyConnections(in.auth)
I have authenticated it through a browser, and my linkedin application page shows connections in the statistics.
However I get an error message as follows:
Error in UseMethod("xpathApply") :
no applicable method for 'xpathApply' applied to an object of class "c('xml_document', 'xml_node')"
Additionally running:
getCompany(token=in.auth, universal_name="Facebook")
Results in error:
Error in if (!is.na(q.content[["number(//error/status)"]] == 404)) { :
argument is of length zero
I tried using the package from github as well, but the same issue occurs.
They changed the rules about the API last May. You have to have a full partnership arraignment through your company to use the functions in that package.
I ran this package with elevated but non-partner privileges after contacting LinkedIn's developer program last year and even then the amount of stuff you could query was trivial and limited to your own profile.
On May 12th 2015 LinkedIn changed the availability for most of their
API endpoints. In order to gain full access to the API, you must apply
to their Partnership Program. You can find detailed information
regarding what endpoints are still openly available in their
Transition Guide.
Regarding this R package, the following lists cover which functions
are and are not available for non-partners. If I gain access to their
partnership program I will update the package accordingly.
As you can see from the quote above (taken from the package's GitHub page), even the package's author doesn't have partner access.

RAdwords Not working

I am using RAdwords package to export the data from Google Adwords. Below is the code I am running and the error I am getting.
body <- statement(select=c('Clicks','AveragePosition','Cost','Ctr'),
report="ACCOUNT_PERFORMANCE_REPORT",
start="20150101",
end="20151231")
data <- getData(clientCustomerId="XXX-XXX-XXXX",
google_auth=google_auth,
statement=body)
Error in if (data[nrow(data), 1] == "Total") { :
argument is of length zero
It seems like maybe you're having an issue that's not tracked well by the error that's thrown. I had a similar issue and it turned out that I didn't have the correct level of access needed with my developer token. You may need to work with your team to get access to a developer token with at least basic access in order to access client information through your MCC using RAdwords. Test account access is not enough to access client data.

Not able to connect to my Google Account using gconnect function of gtrendsR package

In order to start working with the newly developed package "gtrendsR" (the version 1.3.1 released by 2015-12-10) which in fact is a package to Perform and Display Google Trends Queries, you should connect to a google account. I have tried it several times to connect to my gmail account just as it is written in the instructions, but I have not been able to connect yet.
gconnect("usr#gmail.com", "psw")
It gives me this error:
Error in function (type, msg, asError = TRUE) :
Operation timed out after 0 milliseconds with 0 out of 0 bytes received
I have no idea how to fix it guys...!!??
Package Co-Maintainer here. We write about this in README.md and in the help page.
Maybe you have you two-factor authentication? Maybe you are behind some type of firewall and you need to try out in the open? It "works for me" with a dedicated account I created for Google Trends; others use the same trick.
If you file an issue ticket, or better still, read the existing discussion over there, you may get some better help. Right now your question is unanswerable due to lack of specifics or reproducible results.
As Dirk Eddelbuettel wrote, this might be because you are behind a Firewall. If so, you can either unblock the port that you are using for connecting or alternatively use a Proxy Server (I received the same error as you, until I configured a proxy).
For Information on how to configure Internet Access via Proxy in Rstudio see:
RStudio Proxy Configuration on Windows
or
https://support.rstudio.com/hc/en-us/articles/200488488-Configuring-R-to-Use-an-HTTP-or-HTTPS-Proxy
For Setting Proxies in R see:
http://stat.ethz.ch/R-manual/R-patched/library/utils/html/download.file.html

Resources