微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

RStudio Shiny App 不发布,因为数据来自需要身份验证的 Sharepoint

如何解决RStudio Shiny App 不发布,因为数据来自需要身份验证的 Sharepoint

我写了一个闪亮的代码,它从内部网共享点(带身份验证)检索数据,修改它们,然后让用户可以下载 Finel 数据集。它在我的笔记本电脑上完美运行,但在 RStudioConnect 上发布时出现问题。我认为它来自身份验证参数(尽管它们在本地工作)。有人能帮我吗?这是我的代码

library(tidyverse)
library(shiny)
library(DT)
require(httr)
require(getpass)
library(readr)
library(xlsx)
library(RCurl)
library(XML)
library(readxl)
user <- getpass(msg="Enter User ID: ")
pw <- getpass(msg="Enter password: ")

#confidential datas so i'm replacing the content but everything work well on local

Sys.setenv("no_proxy" = "app.host.confidential")
url <- "https://host.confidential/Activation.xls" 
urlinput <- "https://host.confidential/input.xlsm"
urlcloudtelephony <- "https://host.confidential/cloud.xlsx"


GET(url,use_proxy("192.168.190.3",9099,user,pw,"ntlm"),authenticate(user,write_disk(TF <- tempfile(fileext = ".xls")))

GET(urlinput,write_disk(TFinput <- tempfile(fileext = ".xlsm")))

GET(urlcloudtelephony,write_disk(cloud <- tempfile(fileext = ".xlsx")))

df <- read_excel(TF)
dfinput <- read_excel(TFinput)
dfcloud <- read_excel(cloud)
#local file
revenues<- read_excel("Edpnet/pack offer revenues.xlsx")



# Transformation and jointure on data give me my final dataset : x6

partner <- x6 %>% select(Partner) %>% distinct() %>% pull()


# shiny app 
ui <- fluidPage(
    h1("Data Download Dashboard"),sidebarLayout(
        sidebarPanel
        
        (
            
            selectInput("Partner",label = "Choose species",partner,selected = partner),downloadButton("download1","Download entire Table  as csv")),mainPanel(h4("Table 1: Iris"),dataTableOutput("iris_dto")
        )
    ))

server <- function(input,output,session) {
    
    thedata <- reactive({
        x6 %>% 
            filter(Partner == input$Partner)
    })
    
    output$iris_dto <- renderDataTable({
        thedata()  %>% 
            datatable(extensions = 'Buttons',options = list(
                          #Each letter is a dif element of a datatable view,this makes buttons the last thing that's shown.
                          dom = 'lfrtipB',buttons = c("copy","csv","pdf")),filter = list(
                          position = 'top'),rownames = FALSE)
    })
    
    
    output$download1 <- downloadHandler(
        filename = function() {
            paste("iris_",Sys.Date(),".csv",sep="")
        },content = function(file) {
            write.csv(thedata(),file)
        }
        
    )
}
    

shinyApp(ui=ui,server = server)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。