question

Upvotes
Accepted
1 1 0 0

Package DatastreamDSWS2R error requesting acces Token

Hello,

I am trying to download data from Datastream directly in R using

require(devtools)
install_github("CharlesCara/DatastreamDSWS2R")

This works so far.

next I saved my username and password (those credential I use for Refinitive) and entered

mydsws <- dsws$new(username=DatastreamUsername,password=DatastreamPassword)

This throws the following error

> mydsws <- dsws$new(username=DatastreamUsername,password=DatastreamPassword)
...retrying
...retrying
...retrying
...retrying
Error in .self$.loadToken() : 
  Error requesting access Token.  Error message was:
Timeout was reached: [product.datastream.com] Connection timed out after 10001 milliseconds

Do you know why or do you have a solution for me?

datastream-apidsws-apirtoken
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
16.7k 31 9 12

Hi,

Based on all given error messages, it seems to me that your machine cannot connect to DataStream server. I suggest you contact your network or IT team to verify a connection problem on your side.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
52.4k 134 44 63

@Michael

From the error, the request was timed out. You can try the following code to directly send a request to the server.

library(httr)
token_url <- paste("http://product.datastream.com/DSWSClient/V1/DSService.svc/rest/Token?username=",
                   DatastreamUsername,
                   "&password=",
                  DatastreamPassword,
                   sep="")
test <- httr::GET(token_url, httr::timeout(300))
test
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
1 1 0 0

@jirapongse.phuriphanvichai

Thank you very much for your answer. However this seems not to fix the problem as it still throws an timeout error.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

It could be a network issue. You need to contact your network team to verify the problem. If you need to connect through a proxy, you can use the following command to set the http_proxy.

Sys.setenv(http_proxy="http://127.0.0.1:8080")
DatastreamUsername <- "username"
DatastreamPassword <- "password"
mydsws <- dsws$new(username=DatastreamUsername, password=DatastreamPassword)


I tried it and this produced a new error:

Error in .self$.loadToken() : 
  Error requesting access Token.  Error message was:
Failed to connect to 127.0.0.1 port 8080: Connection refused

127.0.0.1:8080 is my test proxy. You should contact the network or IT team to verify the problem.

Upvotes
1 1 0 0

Hello @zoya.farberov, I tried using my local proxy but now I am encountering a new error which is:

Client error: (403) Forbidden

Since I am not an IT specialist, I am kind of stuck at this point. Do you know a solution for that? Best regards Michael

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.