Using Cookies To Access HTML
<p>I'm trying to access a site (for which I have a login) through a <code>.get(url)</code> request. However, I tried passing the cookies that should authenticate my request but I keep getting a <code>401</code> error. I tried passing the cookies in the <code>.get</code> argument like so </p>

<pre><code>requests.post('http://eventregistry.org/json/article?action=getArticles&amp;articlesConceptLang=eng&amp;articlesCount=25&amp;articlesIncludeArticleConcepts=true&amp;articlesIncludeArticleImage=true&amp;articlesIncludeArticleSocialScore=true&amp;articlesPage=1&amp;articlesSortBy=date&amp;ignoreKeywords=&amp;keywords=soybean&amp;resultType=articles', data = {"connect.sid': "long cookie found on chrome settings")
</code></pre>

<p>(Scroll over to see how cookies were used. Apologies for super long URL)</p>

<p>Am I approaching the cookie situation the wrong way? Should I login in with my username or password instead of passing the cookies? Or did I misinterpret my Chrome's cookie?</p>

<p>Thanks!</p>

<p>Solved: </p>

<pre><code>import requests

payload = {
    'email': '###@gmail.com',  #find the right name for the forms from HTML of site
    'pass': '###'}

# Use 'with' to ensure the session context is closed after use.
with requests.Session() as s:
    p = s.post('loginURL')
    r = s.get('restrictedURL') 
    print(r) #etc
</code></pre>

python post cookies