2017-03-24 20 views
0

私は私の結果は Pythonコードですthingspace Verizonのcloud.following上でいくつかの操作を実行するためにraspberrypi3ため、このPythonコードを書いた:APIを介してデータを取得し、データを投稿する方法

import requests 
    r = requests.get('https://thingspace.io/follow/colorssoft', params={'q': 'raspberry pi'}) 
    r = requests.get('https://thingspace.io/follow/colorssoft', headers={'X-Platform': 'RaspberryPi'}) 
    print r.status_code 
    print r.headers 
    print r.text[0:1000] 

ターミナル出力:

[email protected]:~ $ python 11.py > file.html 
    [email protected]:~ $ 
    [email protected]:~ $ python 13.py 
    200 
    {'content-encoding': 'gzip', 'transfer-encoding': 'chunked', 'connection': 'keep-alive', 'date': 'Fri, 24 Mar 2017 09:56:52 GMT', 'access-control-allow-origin': '*', 'content-type': 'text/html'} 
    <!DOCTYPE html> 
    <html lang="en"> 
    <head> 
     <meta charset="utf-8"> 
     <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
     <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
     <meta name="description" content="Ridiculously simple data sharing for the Internet of Things."> 
     <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"> 

     <title>thingspace.io - Share your thing- like it ain't no thang.</title> 

     <!-- Bootstrap core CSS --> 
     <link href="/assets/css/bootstrap.css" rel="stylesheet"> 
     <link href="/assets/css/bootstrap.icon-large.min.css" rel="stylesheet"> 

     <!-- Custom styles for this template --> 
     <link href="/assets/css/main.css" rel="stylesheet"> 

     <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> 
     <!--[if lt IE 9]> 
     <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> 
     <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> 
     <![ 
    [email protected]:~ $ python 13.py > file1.html 

を感謝する前に

答えて

関連する問題