Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd7cf680

Browse files
zaycodesbrendajerop
authored andcommitted
fixed sample codes to return json content
1 parentcfc313f commitd7cf680

File tree

5 files changed

+8
-2
lines changed

5 files changed

+8
-2
lines changed

‎javascript/main_module.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ var url = "https://en.wikipedia.org/w/api.php";
1313

1414
varparams={
1515
action:"help",
16+
wrap:"",
1617
format:"json"
1718
};
1819

‎mediawikijs/main_module.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
varparams={
1313
action:'help',
14+
wrap:'',
1415
format:'json'
1516
},
1617
api=newmw.Api();

‎modules.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,7 @@
749749
"endpoint":"https://en.wikipedia.org/w/api.php",
750750
"params": {
751751
"action":"help",
752+
"wrap":"",
752753
"format":"json"
753754
}
754755
}

‎php/main_module.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
$endPoint ="https://en.wikipedia.org/w/api.php";
1515
$params = [
1616
"action" =>"help",
17+
"wrap" =>"",
1718
"format" =>"json"
1819
];
1920

@@ -24,4 +25,5 @@
2425
$output =curl_exec($ch );
2526
curl_close($ch );
2627

27-
var_dump($output );
28+
$result =json_decode($output,true );
29+
var_dump($result );

‎python/main_module.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919

2020
PARAMS= {
2121
"action":"help",
22+
"wrap":"",
2223
"format":"json"
2324
}
2425

2526
R=S.get(url=URL,params=PARAMS)
26-
DATA=R.content
27+
DATA=R.json()
2728

2829
print(DATA)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp