Saya sudah mencoba masuk di pyload melalui api web, tetapi wget tidak menyimpan cookie dan saya tidak mengerti mengapa.
Saya menggunakan perintah berikut:
wget --delete-after --keep-session-cookies --save-cookies=my_cookies.txt --post-data="username=USERNAME&password=PASSWORD" http://localhost:8000/api/login
Tetapi konten my_cookies.txt adalah:
# HTTP cookie file.
# Generated by Wget on 2012-06-23 22:31:33.
# Edit at your own risk.
Ketika saya menjalankan perintah yang sama tetapi dalam mode debug saya mendapatkan output berikut yang mencakup cookie yang ditetapkan dalam respons header:
DEBUG output created by Wget 1.10.2 (Red Hat modified) on linux-gnueabi.
--22:31:11-- http://localhost:8000/api/login
Resolving localhost... 127.0.0.1
Caching localhost => 127.0.0.1
Connecting to localhost|127.0.0.1|:8000... connected.
Created socket 3.
Releasing 0x000504d0 (new refcount 1).
---request begin---
POST /api/login HTTP/1.0
User-Agent: Wget/1.10.2 (Red Hat modified)
Accept: */*
Host: localhost:8000
Connection: Keep-Alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 32
---request end---
[POST data: username=USERNAME&password=PASSWORD]
HTTP request sent, awaiting response...
---response begin---
HTTP/1.1 200 OK
Content-Length: 34
Content-Type: application/json
Cache-Control: no-cache, must-revalidate
Set-cookie: beaker.session.id=405390ddc809efed54820638c95d7997; expires=Tue, 19-Jan-2038 04:14:07 GMT; Path=/
Connection: Keep-Alive
Date: Sat, 23 Jun 2012 21:31:11 GMT
Server: CherryPy/3.1.2 WSGI Server
---response end---
200 OK
hs->local_file is: login (not existing)
Registered socket 3 for persistent reuse.
TEXTHTML is on.
Length: 34 [application/json]
Saving to: `login'
100%[=======================================>] 34 --.-K/s in 0s
22:31:11 (1.28 MB/s) - `login' saved [34/34]
Removing file due to --delete-after in main():
Removing login.
Saving cookies to my_cookies.txt.
Done saving cookies.
Adakah yang bisa memberitahu saya apa yang saya lakukan salah?