Rlinkedin API not connecting, getting timeout error - r

I am trying to use the linkedin API to access some data for a project. I am following the instructions provided by https://github.com/mpiccirilli/Rlinkedin . But no matter what I do I run into a time out error:
library(pacman)
p_load(rvest,ggplot2,Rlinkedin,httr,curl,devtools,dplyr,devtools)
in.auth <- inOAuth()
The console returns this message:
If you've created you're own application, be sure to copy and paste
the following into 'OAuth 2.0 Redirect URLs' in the LinkedIn
Application Details: http://localhost:1410/ When done, press any key
to continue... Use a local file ('.httr-oauth'), to cache OAuth access
credentials between R sessions?
1: Yes 2: No
I click 1 or 2 and I get the same error:
Adding .httr-oauth to .gitignore Error in curl::curl_fetch_memory(url,
handle = handle) : Timeout was reached: Connection timed out after
10000 milliseconds
No matter what I try I get the same error, any help would be very very very appreciated.

Related

How to resolve gargle error when reading a Google sheet into R?

I'm trying to read a Google sheet in RStudio and even though the authentication goes through without a hitch, I keep getting a gargle error:
✖ Request failed [503]. Retry 1 happens in 1.9 seconds ...
Error in `gargle::response_process()`:
! Client error: (400) INVALID_ARGUMENT
• Client specified an invalid argument. Check error
message and error details for more information.
• Request contains an invalid argument.
Backtrace:
1. googlesheets4::read_sheet("sheet link")
2. googlesheets4:::get_cells(...)
3. googlesheets4::gs4_get(ssid)
4. googlesheets4:::gs4_get_impl_(as_sheets_id(ss))
5. gargle::response_process(raw_resp)
Here is my initial code:
library(googlesheets4)
read_sheet("sheet link")
Is it OK to cache OAuth access credentials in the folder
~/Library/Caches/gargle between R sessions?
1: Yes
2: No
Selection: 1
The httpuv package enables a nicer Google auth experience,
in many cases.
It doesn't seem to be installed.
Would you like to install it now?
1: Yes
2: No
Selection: 1
I've explored different documentation online but can't seem to find a solution.

googleAnalyticsR/googleAuthR token seems to expire in shiny markdown

here's my problem.
I access Google Analytics API via R with googleAnalyticsR. The whole thing happens in a Markdown script. Local everything runs without problems. But when I load the script on a Shiny Sever the GA token seems to expire after a while (a few hours).
The server log gives the following error message:
Warning in gzfile(file, mode) :
cannot open compressed file '.httr-oauth', probable reason 'Permission denied'
The script to create the token looks like this:
library(googleAuthR)
options(googleAuthR.client_id = "client-id",
googleAuthR.client_secret = "client-secret")
gar_auth()
I read that I should add
googleAuthR.httr_oauth_cache = FALSE
to the options. But when I do this and try to create a new Token I get follwing error:
Error: option('googleAuthR.httr_oauth_cache') must be set to
valid cache file location,
not TRUE or FALSE - (example: '.httr-oauth')
Anybody Ideas?
Thanks a lot
The issue is not that the token expires, the package googleAnalyticsR takes care of refreshing it if needed.
The problem is that the token was not created on the server (I assume you created locally then pushed to server), hence the error:
Warning in gzfile(file, mode) : cannot open compressed file '.httr-oauth', probable reason 'Permission denied'
The shinyuser which runs your app does not have the permission to open that file. I'm not a security expert so take this lightly. You run the following from the root of your application (on your server) there error will go away.
sudo chmod -R 777 .httr-oauth
The above will let shiny access the file.

Get data from OpenDap server that requires authentication using R

I'm trying to get data from an OPeNDAP server using R and the ncdf4 package. However, the nasa eosdis server requires username / password. How can I pass this info using R?
Here is what I'm trying to do:
require(ncdf4)
f1 <- nc_open('https://disc2.gesdisc.eosdis.nasa.gov/opendap/TRMM_L3/TRMM_3B42.7/2018/020/3B42.20180120.15.7.HDF')
And the error message:
Error in Rsx_nc4_get_vara_double: NetCDF: Authorization failure syntax
error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or
SCAN_ERROR context: HTTP^ Basic: Access denied. Var: nlat Ndims: 1
Start: 0 Count: 400 Error in ncvar_get_inner(d$dimvarid$group_id,
d$dimvarid$id, default_missval_ncdf4(), : C function
R_nc4_get_vara_double returned error
I tried the url https://username:password#disc2.... but that did not work also.
Daniel,
The service you are accessing is using third-party redirection to authenticate users. Therefore the simple way of providing credentials in the URL doesn't work.
You need to create 2 files.
A .dodsrc file (a RC file for the netcdf-c library) with the following content
HTTP.COOKIEFILE=.cookies
HTTP.NETRC=.netrc
A .netrc file, in the location referenced in the .dodsrc, with your credentials:
machine urs.earthdata.nasa.gov
login YOURUSERNAMEHERE
password YOURPASWORDHERE
You can find more details at
https://www.unidata.ucar.edu/software/netcdf/docs/md__Users_wfisher_Desktop_v4_86_81-prep_netcdf-c_docs_auth.html
Regards
Antonio
unfortunately, even after defining the credentials and their location
ncdf4::nc_open("https://gpm1.gesdisc.eosdis.nasa.gov/opendap/GPM_L3/GPM_3IMERGDE.06/2020/08/3B-DAY-E.MS.MRG.3IMERG.20200814-S000000-E235959.V06.nc4")
still returns
Error in Rsx_nc4_get_vara_double: NetCDF: Authorization failure
The same happens when using ncdump from a terminal:
$ ncdump https://gpm1.gesdisc.eosdis.nasa.gov/opendap/GPM_L3/GPM_3IMERGDE.06/2020/08/3B-DAY-E.MS.MRG.3IMERG.20200814-S000000-E235959.V06.nc4
returns
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or
SCAN_ERROR context: HTTP^ Basic: Access denied. NetCDF: Authorization
failure Location: file
/build/netcdf-KQb2aQ/netcdf-4.6.0/ncdump/vardata.c; line 473

After upgrade attempting to get artifact results in "Could not process download request: Binary provider has no content for"

I recently upgraded our artifactory repository from 2.6.5 to the current version 5.4.6.
However, something seems to have gone wrong in the process. There are some artifacts that throw a HTTP 500 error when attempting to access them. Here is an example using wget:
wget http://xyz.server.com:8081/artifactory/gradle/org/jfrog/buildinfo/build-info-extractor-gradle/2.0.12/build-info-extractor-gradle-2.0.12.pom
--2017-09-12 12:17:13--
http://xyz.server.com:8081/artifactory/gradle/org/jfrog/buildinfo/build-info-extractor-gradle/2.0.12/build-info-extractor-gradle-2.0.12.pom
Resolving xyz.server.com (xyz.server.com)... 10.125.1.28
Connecting to xyz.server.com (xyz.server.com)|10.125.1.28|:8081... connected.
HTTP request sent, awaiting response... 500 Internal Server Error
2017-09-12 12:17:13 ERROR 500: Internal Server Error.
I verified this by going to the artifactory site, browsing to the object in question, and trying to download it. The result was the following:
{
"errors" : [ {
"status" : 500,
"message" : "Could not process download request: Binary provider has no content for 'e52a9a9a58d6829b7b13dd841af4b027c88bb028'"
} ]
}
The problem seems to be in the final step of the upgrade process, upgrading from 3.9.5 to 5.4.6. The wget command above works on 3.9.5, but not on the 5.4.6 instance.
I found a reference to a "Zap Cache" function in older documentation and thought it might fix things, but I don't seem to be able to find that function in the current site.
Is anyone able to point me to: a way to fix this issue, or what I need to do/look for in the upgrade process in order to prevent it from occurring?
As a further data point, we're using an Oracle database for the full file store, if that matters in any way (using the tag: <chain template="full-db"> in binarystore.xml)
Thanks in advance....

Jmeter: Response code: Non HTTP response code: javax.net.ssl.SSLHandshakeException

I have an application URL. I need to run login test using Jmeter. I recorded the login steps using blazemeter extension of chrome. But when I run it I get below error. I know there have been questions like this, I have tried few and it seems my case is different.
I have tried:
Added these two lines in jmeter.bat
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_65
set PATH=%JAVA_HOME%\bin;%PATH%
Run Jmeter using "Run as Administrator"
Download the certificate from here https://gist.github.com/borisguery/9ef114c53b83e553b635 and install it this way
https://www.youtube.com/watch?v=2k581jcWk9M
Restart the Jmeter but and try again but no luck.
When I expand the error in Jmeter View tree listener I get error on this particular css file: https://abcurl.xyzsample.com/assets/loginpage/css/okta-sign-in.min.7c7cfd15fa939095d61912dd8000a2a8.css
Error:
Thread Name: Thread Group 1-1
Load time: 268
Connect Time: 0
Latency: 0
Size in bytes: 2256
Headers size in bytes: 0
Body size in bytes: 2256
Sample Count: 1
Error Count: 1
Response code: Non HTTP response code: javax.net.ssl.SSLHandshakeException
Response message: Non HTTP response message: Received fatal alert: handshake_failure
Response headers:
HTTPSampleResult fields:
ContentType:
DataEncoding: null
If you are getting error for only one .css file and it does not belong to the application under test (i.e. it is an external stylesheet) the best thing you could do is just to exclude it from the load test via URLs must match section which lives under "Advanced" tab of the HTTP Request Defaults configuration element.
If you need to load this .css by any means you could also try the following approaches:
Play with https.default.protocol and https.socket.protocols properties (look for the above lines in jmeter.properties) file
Install Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files into /jre/lib/security folder of your JRE or JDK home (replace existing files with the downloaded ones)
If your url needs a client certificate, then copy your cert to /bin folder and from the jmeter console if you go to options -> SSL Manager and select your cert , it would prompt you for the certificate password . And if you run your tests again , that should work .
Additionally you can also do keystore configuraion (http://jmeter.apache.org/usermanual/component_reference.html#Keystore_Configuration) , if you haven't done already .
Please Note that my jmeter version is 4.0 . Hope this helps .

Resources