2017-12-31 140 views
-1

APIからデータを抽出しようとしていますが、ドキュメントでAPIキーが1つしか与えられていませんでした。API公開キーなしでAPI GETリクエストを作成する方法

これは、私はドキュメントのドキュメントの下に基づいて在庫を言うためのデータを引き出すためにPythonで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 

私は応答ステータスを取得していた場合、私は、データを取得するためにやっているかわからないよ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)は、このメッセージを得た

蘭の印刷

Pythonのanacondaウィンドウに情報をプルすると、ブラウザは古くなってしまいますか?

+0

'print(r.text)'を実行します。 – eyllanesc

+0

は編集を行いました。データがpython anacondaモジュールに入ってきたら、どうすればいいでしょうか? – RustyShackleford

+0

アナコンダは分かりませんが、JSON APIの場合はJSON GETを作成したくないですか? –

答えて

0

他のAPI情報がドキュメントに記載されていません。

関連する問題