Skip to content

Commit 9f7e857

Browse files
author
Marko Obrovac
authored
Send the UA when making requests to the API and RESTBase (#6)
1 parent b8b3f39 commit 9f7e857

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

bin/dump_wiki

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ var argParser = require('yargs')
2121
alias: 'startTitle',
2222
default: ''
2323
})
24+
.options('a', {
25+
alias: 'userAgent',
26+
default: 'HTMLDumper'
27+
})
2428
.options('db', {
2529
alias : 'dataBase',
2630
default : ''

lib/htmldump.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ function getArticles (options, res) {
4848
return preq.get({
4949
uri: options.apiURL,
5050
query: query,
51+
headers: {
52+
'user-agent': options.userAgent,
53+
host: options.prefix
54+
},
5155
timeout: 60* 1000,
5256
retries: 5
5357
})
@@ -96,6 +100,7 @@ function dumpArticle (options, title, oldid) {
96100
return preq.get({
97101
uri: url,
98102
headers: {
103+
'user-agent': options.userAgent,
99104
'accept-encoding': 'gzip'
100105
},
101106
retries: 5,

0 commit comments

Comments
 (0)