상세 컨텐츠

본문 제목

Python HTTP Networking request

개발생활/Python

by 한국인맛집 2018. 12. 18. 15:11

본문

반응형

Python HTTP 



  • How to use Request Module  


    • import requests
      
      website = 'https://localhost:8080'
      req = reqeusts.get(website)
      
      print req.status_code
      
      print req.text // Request 로 응답받은 값을 텍스트로 출력.
      
      




    • HTTP Get passing Parameters

      • import requests
        
        website = 'https://localhost:8080'
        
        
        
        data = {'param0':'data;,'param1':'data1'}
        req = request.get(website,data=data)
        
        




      • HTTP Post request

        • import requests
          
          website = 'https://localhost:8080'
          
          
          
          data = {'param0':'data;,'param1':'data1'}
          req = request.post(website,data=data)
          
          



        • HTTP Post Json request

          • import requests
            improt json
            
            website = 'https://localhost:8080'
            
            
            data = {'out' : {'inner':'value'}}
            
            req = request.post(website,data = json.dump(data))
            
            








            반응형

            관련글 더보기