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?

Best Answer

  • wasin.w
    wasin.w admin
    Answer ✓

    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.

Answers

  • @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
  • jirapongse.phuriphanvichai

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

  • 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.

  • 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