Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6650125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:51:21+00:00 2026-05-26T00:51:21+00:00

Below is my code for adding a cookie to get a page using getPage.

  • 0

Below is my code for adding a cookie to get a page using getPage. Also is the error message I get. How to I add a cookie? Is cookie is None then the code works.

 cj = cookielib.CookieJar()
 client.getPage(iUrl,headers,method='GET',cookies=cj).addCallback(self.processPage,iUrl).addErrback(self.printError,iUrl)




Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 84, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 69, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 59, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 37, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/usr/lib/python2.7/dist-packages/twisted/internet/selectreactor.py", line 146, in        _doReadOrWrite
why = getattr(selectable, method)()
File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 664, in doConnect
self._connectDone()
File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 671, in _connectDone
self.protocol.makeConnection(self)
File "/usr/lib/python2.7/dist-packages/twisted/internet/protocol.py", line 459, in makeConnection
self.connectionMade()
File "/usr/lib/python2.7/dist-packages/twisted/web/client.py", line 61, in connectionMade
   for cookie, cookval in self.factory.cookies.items():
exceptions.AttributeError: CookieJar instance has no attribute 'items'
*--- Failure #133 ---
Failure: exceptions.AttributeError: CookieJar instance has no attribute 'items'
*--- End of Failure #133 -
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:51:22+00:00Added an answer on May 26, 2026 at 12:51 am

    Looks like you’re passing a cookiejar in the cookie argument. I can’t find a reference for that working.

    I’ve tried passing a simple dict and it works. Here’s the full code:

    from twisted.web import client
    import pprint
    
    def processPage (page, url):
        print len(page), 'bytes received'
        print 'cookies: ', pprint.pformat(cj)
    
    def printError(error, url):
        print 'ERROR: ', error.getErrorMessage()
    
    def end(ignore):
        reactor.stop()
    
    iUrl = 'http://twistedmatrix.com'
    
    headers = []
    
    cj = {}
    client.getPage(iUrl,headers,method='GET',cookies=cj).addCallback(processPage,iUrl).addErrback(printError,iUrl).addBoth(end)
    
    
    from twisted.internet import reactor
    reactor.run()
    

    And here’s output:

    10660 bytes received
    cookies: 
    {'trac_form_token': '940bfe8055b63872303017ba',
     'trac_session': '5a3500ec1bc8efad40974a31'}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using below code: Redemption.RDOAppointmentItem objAppointment; Redemption.RDORecurrencePattern objRecurrence; objAppointment = (Redemption.RDOAppointmentItem)p_objDestFolder.Items.Add( p_objDestFolder.DefaultItemType); objAppointment.OptionalAttendees
I have written the code below for adding products to a basket, then outputting
I have the below code in stdafx.h. using namespace std; typedef struct { DWORD
I got below mentioned code for adding my application to Windows Firewall Exception list.
I have the below code that was working fine until I tried adding the
I've been using the below code fine for a quick and efficient function of
The below code is for go to photo albums.The below code shows an error.
I would like to add an if statement to the below code that checks
I am using checkbox with ListView.Code is working fine. I strucked to get all
When running the below code a type is never returned, despite there being a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.