Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将网页中的数据导入iseries并使用Python进行处理_Python_Ibm Midrange_Iseries Navigator - Fatal编程技术网

如何将网页中的数据导入iseries并使用Python进行处理

如何将网页中的数据导入iseries并使用Python进行处理,python,ibm-midrange,iseries-navigator,Python,Ibm Midrange,Iseries Navigator,我在我们的内联网页面上有一个dr存储详细信息列表 我需要构建一个实用程序,使提供的输入日期能够以某种方式从网页中获取卷和序号详细信息,并相应地访问db2数据库 我曾考虑/学习pyhon使用bs4 soup来刮取网页上的数据,但现在我该如何将数据输入iseries。这可能吗?您可以使用sql函数httpgetclob读取网页内容 下面是在sql过程中使用httpgetclob的示例代码。该过程将httpgetclob输出接收到clob变量中。然后读取该输出的256字节块,并将这些块写入输出文件 以

我在我们的内联网页面上有一个dr存储详细信息列表

我需要构建一个实用程序,使提供的输入日期能够以某种方式从网页中获取卷和序号详细信息,并相应地访问db2数据库


我曾考虑/学习pyhon使用bs4 soup来刮取网页上的数据,但现在我该如何将数据输入iseries。这可能吗?

您可以使用sql函数
httpgetclob
读取网页内容

下面是在
sql过程中使用
httpgetclob
的示例代码。该过程将
httpgetclob
输出接收到
clob
变量中。然后读取该输出的256字节块,并将这些块写入输出文件

以下是输出文件:

/* test0244 - web page text contents.        */           
                                                          
CREATE OR REPLACE TABLE TEST0244 (
pageName   char(20),
seqnbr   decimal(7,0),
text     char(256) not null default ' ', 
constraint test0244_pk primary key( pageName, seqnbr )    
) ; 
获取网页内容并写入输出表的sql过程:

/* test0244_getWebPage - get contents of web page.    */ 
/*                       Store in table TEST0244.     */ 

CREATE or replace PROCEDURE test0244_getWebPage( 
 in inPageName char(20), 
 in inUrl    char(256) 
 ) 
  LANGUAGE           SQL
  MODIFIES           SQL DATA
  SET OPTION         COMMIT = *NONE 
BEGIN
declare     vSqlCode decimal(5,0) ; 
declare     sqlCode int DEFAULT 0 ;                      
declare      url varchar(2000) ;                         
declare      webClob clob(500000) ;                      
declare      web_lx int ;                                
declare      bx  int ;                                   
declare      rem int default 0 ; 
declare      segSx int ; 
declare      segLx int ; 
declare      segText varchar(2000) ; 
declare      seqnbr decimal(7,0) default 0 ; 

/* clear current page contents.      */               
delete from  test0244 a                               
where        a.pageName = inPageName ;                
                                                      
set        url = inUrl ;                              
set        webClob = SYSTOOLS.httpGetClob( url, '' ) ;
set        web_lx  = length( webClob ) ;              
set        bx = 1 ;                                   
set        segSx = 256 ;                              
set        seqnbr = 0 ;                               
while( bx <= web_lx ) do                              
set        rem = web_lx - bx + 1 ;                    
set        segLx = case when rem >= segSx             
                        then segSx                    
                        else rem end ;                
set        segText = substr( webClob, bx, segLx ) ;   
set        seqnbr  = seqnbr + 1 ;                     
insert into   test0244  ( pageName, seqnbr, text )    
values( inPageName, seqnbr, segText ) ;               
                                                      
set        bx = bx + segLx ;                          
end while ;
END 

您是否在问是否可以在IBMi上运行python程序?我在问是否可以执行request.get to a webpage from ibm i,然后用ibm i编写scipt来获取数据。或者也可以采用另一种方法。重点是自动化将存储在Web页面中的详细信息(卷、序号无值)带来的工作,以便我可以建立一个restore命令来从另一个框中恢复数据
call   test0244_getWebPage ( 'craigslist      ',   
          'https://newjersey.craigslist.org/')