์ฟ ํค์ ๋ํ ์ง์์ด ์์ต๋๊น?
๊ธฐ๋ณธ ์์ฒญ lib๊ฐ ์ฟ ํค๋ฅผ ์ง์ํ๋ ๊ฒ ๊ฐ์ต๋๋ค ....
๊ฑด๋ฐฐ,
Govinda
์, ๋ค๋ฅธ ๋ชจ๋ ํค๋์ ๋ง์ฐฌ๊ฐ์ง๋ก ์ฟ ํค๋ฅผ ์ง์ ํ ์ ์์ต๋๋ค.
$ http GET httpbin.org/cookies Cookie:hello=world
HTTP/1.1 200 OK
Content-Type: application/json
Date: Tue, 06 Mar 2012 13:19:45 GMT
Server: gunicorn/0.13.4
Content-Length: 43
Connection: keep-alive
{
"cookies": {
"hello": "world"
}
}
(# 13 ์ฐธ์กฐ)
์ด๊ฒ ๋ค๊ฐ ๋งํ๋๊ฑฐ์ผ?
@jakubroztocil ์๋ฒ์์ ์ค์ ํ ์ฟ ํค๊ฐ ํธ์ถ๊ฐ์ ์ง์๋ ์ ์๋์ง ๊ถ๊ธํฉ๋๋ค. httpie์์ ์ด๊ฒ์ด ๊ฐ๋ฅํฉ๋๊น? ์๋ฅผ ๋ค์ด ์ด๊ฒ์ ์ฌ์ฉํ์ฌ ์ธ์ ๊ธฐ๋ฐ API ํธ์ถ์ ํ ์คํธ ํ ์ ์์ต๋๋ค.
@mcnemesis ์, ์ฟ ํค์ ์ฌ์ฉ์ ์ง์ ํค๋ ๋ฐ ์ธ์ฆ์ด ์์ฒญ๊ฐ์ ์ง์๋๋๋ก ํ์ฉํ๋ ์ธ์ ๊ธฐ๋ฅ์ด ์์ต๋๋ค.
๋๋ฐ! ๊ฐ์ฌํฉ๋๋ค @jakubroztocil
@jakubroztocil ์ฟ ํค ์ค์ ์ json์ ์ฌ์ฉํ ์ ์์ต๋๊น?
{'MOODLEID1_': '%250xxx5C2', 'MoodleSession': 'btsmxxxxxxxosn7'}
์ฒ๋ผ
@NightMachinary ์ธ์ ํ์ผ (https://httpie.org/docs#sessions)์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
cookies
$ cat my-session.json
{
"cookies": {
"MOODLEID1_": {
"value": "%250xxx5C2"
},
"MoodleSession": {
"value": "btsmxxxxxxxosn7"
}
},
}
$ http --session ./my-session.json httpbin.org/headers
GET / HTTP/1.1
Cookie: MOODLEID1_=%250xxx5C2; MoodleSession=btsmxxxxxxxosn7
headers
$ cat my-session.json
{
"headers": {
"Cookie": {
"MOODLEID1_=%250xxx5C2; MoodleSession=btsmxxxxxxxosn7"
}
}
}
$ http --session ./my-session.json httpbin.org/headers
GET / HTTP/1.1
Cookie: MOODLEID1_=%250xxx5C2; MoodleSession=btsmxxxxxxxosn7
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์, ๋ค๋ฅธ ๋ชจ๋ ํค๋์ ๋ง์ฐฌ๊ฐ์ง๋ก ์ฟ ํค๋ฅผ ์ง์ ํ ์ ์์ต๋๋ค.
(# 13 ์ฐธ์กฐ)
์ด๊ฒ ๋ค๊ฐ ๋งํ๋๊ฑฐ์ผ?