2017-12-31 57 views
-1

API에서 데이터를 추출하려고하는데 설명서에서 개인 키라고 가정 한 API 키 하나만 받았습니다.API 공개 키가없는 API GET 요청을 만드는 방법

이것은 내가 (전체 문서를 게시 할 수 없습니다) 문서의 문서 아래에 기반 말 재고에 대한 데이터를 꺼내 파이썬에서 GET 호출을 어떻게 경우는 더 URL이 제공되지 않는 경우?

Public Inventory API 
1.0 
[ Base url: https://partner-gateway.staging.mjplatform.com/v1] https://partners.mjfreeway.com/docs/inventory 
API data related to inventory management 

Schemes 

catalog 

GET 
/catalog 
Listing of Sellable Products 
This request provides a detailed listing of all sellable products, also referred to throughout the system as "item masters", for the active facility. The listing can be filtered by some simple parameters. 
Parameters 
Name Description 
category_id 
integer 
(query) 
The ‘id’ of a single category to which you want to limit results 
subcategory_id 
integer 
(query) 
The ‘id’ of a single subcategory to which you want to limit results 
strain_id 
integer 
(query) 
The ‘id’ of a single strain to which you want to limit results 
item_number 
string 
(query) 
The item number of a particular item master, i.e. BKSA00000003 
uom_type 
string 
(query) 
The method of measurement for the item. Valid options are discrete, weight, and volume 
available_online 
boolean 
(query) 
A boolean indicator of whether the item can be sold online 
경우

이 지금까지 내 코드입니다 :

import requests 

# api-endpoint 
URL = "https://www.mjplatform.com/catalog" 

# location given here 
key = "123abc" 

# defining a params dict for the parameters to be sent to the API 
PARAMS = {URL:key} 

# sending get request and saving the response as response object 
r = requests.get(url = URL, params = PARAMS) 

# extracting data in json format 
data = r.json() 

나는 다음과 같은 메시지가 얻을 위 실행하면 :

ValueError: No JSON object could be decoded 
,536을

나는 응답 상태를 얻고 있다면 데이터를 얻기 위해 무엇을하고 무엇을 잘 모르겠습니다 (200)

편집 :

<!DOCTYPE html><html lang="en"><head><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"><title>MJ Platform</title><link href="/main.b21e9284629fc8bfb7bc9b4158ad44b9.css" rel="stylesheet"></head><body><div id="defaultLoadingMessage"><div style="height:40px"></div><div class="col-md-4 col-md-offset-4"><div><h1 style="text-align:center">Loading MJ Platform</h1><div class="text-muted" style="text-align:center;width:600px;margin:auto;color:#aaa">If you continue to see this message for more than a few seconds, your browser is most likely out of date or incompatible. We support Chrome and Firefox. Other browsers may work but not provide an optimal experience. <strong>Safari and MS IE are specifically not supported.</strong></div></div></div></div><div id="app"></div><script type="text/javascript" src="/main.cccbe56cf819e9f8a6e3.js"></script></body></html> 
: (r.text)이이 메시지를 받았습니다

란 인쇄

파이썬 아나콘다 창으로 정보를 가져 오면 브라우저가 오래되지 않을 수 있습니까?

+0

'print (r.text)'를 실행하십시오. – eyllanesc

+0

이 (가) 이전 버전의 브라우저를 나타내는 메시지를 받았습니다. 데이터가 python anaconda 모듈로 들어오는 경우 어떻게 될 수 있습니까? – RustyShackleford

+0

아나콘다를 모르지만 JSON API를 사용한다면 JSON GET을하고 싶지 않습니까? –

답변

0

다른 API 정보가 설명서에 포함되어 있지 않습니다.