2017-11-19 2 views
0

마지막으로 지난 2 일 동안 고급 검색을 수행 할 때 다음 웹 페이지를 "긁어 내고 싶습니다." https://platformapi.bluetooth.com/Help/Api/POST-api-Platform-Listings-Search게시물 요청이 반환됩니다. 404

는하지만, 내 간단한 스크립트 (404)

import requests 
import json 

payload ={ 
    'UserId': '', 
    'MemberId': '', 
    'SearchString': '', 
    'SearchQualificationsAndDesigns': 1, 
    'SearchDeclarationOnly': 1, 
    'SearchEndProductList': 1, 
    'SearchPRDProductList': 1, 
    'SearchMyCompany': 1, 
    'BQAApprovalStatusId': 9, 
    'BQALockStatusId': 10, 
    'ProductTypeId': 1, 
    'SpecName': 1, 
    'ListingDateEarliest': "2017-11-17T09:43:09.2031162-06:00", 
    'ListingDateLatest': "2017-11-18T09:43:09.2031162-06:00", 
    'Layers': [], 
    'MaxResults': 11, 
    'IncludeTestData': 1 
} 

url = 'https://platformapi.bluetooth.com/api/Platform/Listings/Search' 
headers = {'Content-type': 'application/json', 'Accept': 'text/json'} 
r = requests.post(url, data=json.dumps(payload), headers=headers) 
print (r.status_code) 
을 반환 : https://launchstudio.bluetooth.com/Listings/Search

결과는 API

bt.apiUrl = 'https://platformapi.bluetooth.com/'; 
$.ajax({ 
    method: 'post', 
    contentType: "application/json; charset=utf-8", 
    dataType: "json", 
    url: bt.apiUrl +'api/platform/Listings/Search', 
    data: JSON.stringify(this.searchCriteria), 
    success: function (data) { 
     if (data.length) { 
      var listings = data 
      console.log('listing count: ' + listings.length); 
      this.listings = listings; 
     } 

    }.bind(this) 

를 찾은 다음 API 문서를 호출하는 자바 스크립트에 의해 생성 된 것으로 보인다

누구나 볼 수 있습니다? 파이썬 3.5 btw 사용하기.

답변

1
import requests 
import json 

payload = { 
    "searchString":"bluetooth", 
    "searchQualificationsAndDesigns":True, 
    "searchDeclarationOnly":True, 
    "searchEndProductList":False, 
    "searchPRDProductList":True, 
    "searchMyCompany":False, 
    "productTypeId":0, 
    "specName":0, 
    "bqaApprovalStatusId":-1, 
    "bqaLockStatusId":-1, 
    "listingDateEarliest":"", 
    "listingDateLatest":"", 
    "userId":0, 
    "memberId":None, 
    "layers":[], 
    "maxResults":5000 
    } 

url = 'https://platformapi.bluetooth.com/api/Platform/Listings/Search' 
headers = {'Content-type': 'application/json; charset=utf-8', 'Accept': 'text/json'} 
r = requests.post(url, data=json.dumps(payload), headers=headers) 
print (r.status_code) 
#print r.json() 

결과 :

200 
관련 문제