@@ -541,23 +541,22 @@ pc_synonyms <- function(query,
541541
542542 if (! missing(" choices" ))
543543 stop(" 'choices' is deprecated. Use 'match' instead." )
544- foo <- function (query , from , verbose , ... ) {
545- if (is.na(query )) {
544+ foo <- function (x , from , verbose , ... ) {
545+ if (is.na(x )) {
546546 if (verbose ) webchem_message(" na" )
547547 return (NA )
548548 }
549549 prolog <- " https://pubchem.ncbi.nlm.nih.gov/rest/pug"
550- input <- paste0(" /compound/" , from )
550+ input <- paste0(" /compound/" , from , " / " )
551551 output <- " /synonyms/JSON"
552552 if (! is.null(arg ))
553553 arg <- paste0(" ?" , arg )
554- qurl <- paste0(prolog , input , output , arg )
555- if (verbose ) webchem_message(" query" , query , appendLF = FALSE )
554+ qurl <- paste0(prolog , input , utils :: URLencode( x ), output , arg )
555+ if (verbose ) webchem_message(" query" , x , appendLF = FALSE )
556556 webchem_sleep(type = ' API' )
557- res <- try(httr :: RETRY(" POST " ,
557+ res <- try(httr :: RETRY(" GET " ,
558558 qurl ,
559559 httr :: user_agent(webchem_url()),
560- body = paste0(from , " =" , query ),
561560 terminate_on = 404 ,
562561 quiet = TRUE ), silent = TRUE )
563562 if (inherits(res , " try-error" )) {
0 commit comments