Skip to content

Commit

Permalink
add example for a persistent session and logging into a webform (#686)
Browse files Browse the repository at this point in the history
  • Loading branch information
Crghilardi authored Mar 4, 2021
1 parent ed02d37 commit a083bd2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/examples/session.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
A simple example of creating a persistent session and logging into a web form. HTTP.jl does not have a distinct session object like requests.session() or rvest::html_session() but rather uses the `cookies` flag along with standard functions
"""
using HTTP

#dummy site, any credentials work
url = "http://quotes.toscrape.com/login"
session = HTTP.get(url; cookies = true)

credentials = Dict(
"Username" => "username",
"Password" => "password")

response = HTTP.post(url, credentials)

0 comments on commit a083bd2

Please sign in to comment.