stopped using Twitter session info for userID requests
This commit is contained in:
parent
d5689f2253
commit
6875569bf2
1 changed files with 6 additions and 4 deletions
|
@ -43,10 +43,6 @@ proc genHeaders*(token: Token = nil): HttpHeaders =
|
||||||
"accept": "*/*",
|
"accept": "*/*",
|
||||||
"DNT": "1"
|
"DNT": "1"
|
||||||
})
|
})
|
||||||
if len(cfg.cookieHeader) != 0:
|
|
||||||
result.add("Cookie", cfg.cookieHeader)
|
|
||||||
if len(cfg.xCsrfToken) != 0:
|
|
||||||
result.add("x-csrf-token", cfg.xCsrfToken)
|
|
||||||
|
|
||||||
template updateToken() =
|
template updateToken() =
|
||||||
if api != Api.search and resp.headers.hasKey(rlRemaining):
|
if api != Api.search and resp.headers.hasKey(rlRemaining):
|
||||||
|
@ -105,6 +101,12 @@ template fetchImpl(result, additional_headers, fetchBody) {.dirty.} =
|
||||||
raise rateLimitError()
|
raise rateLimitError()
|
||||||
|
|
||||||
proc fetch*(url: Uri; api: Api; additional_headers: HttpHeaders = newHttpHeaders()): Future[JsonNode] {.async.} =
|
proc fetch*(url: Uri; api: Api; additional_headers: HttpHeaders = newHttpHeaders()): Future[JsonNode] {.async.} =
|
||||||
|
|
||||||
|
if len(cfg.cookieHeader) != 0:
|
||||||
|
additional_headers.add("Cookie", cfg.cookieHeader)
|
||||||
|
if len(cfg.xCsrfToken) != 0:
|
||||||
|
additional_headers.add("x-csrf-token", cfg.xCsrfToken)
|
||||||
|
|
||||||
var body: string
|
var body: string
|
||||||
fetchImpl(body, additional_headers):
|
fetchImpl(body, additional_headers):
|
||||||
if body.startsWith('{') or body.startsWith('['):
|
if body.startsWith('{') or body.startsWith('['):
|
||||||
|
|
Loading…
Reference in a new issue