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 9299173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:29:53+00:00 2026-06-18T22:29:53+00:00

basically I have a really default setup, a spider subclassed from CrawlSpider and an

  • 0

basically I have a really default setup, a spider subclassed from CrawlSpider and an item with three fields looking like this:

class AppdexItem(Item):
    name = Field()
    url = Field()
    desc = Field()

When my spider parses a response it populates an item like this:

i = AppdexItem()
name = hxs.select("//h1[@class='doc-banner-title']/text()")
i['name'] = name.extract()[0]

Now I got confused when I read what Field actually is. This is literally its implementation:

 class Field(dict):
     """Container of field metadata"""

It’s a plain simple dict. I wondered why that is and stared at the implementation for a while. It still didn’t make any sense. So I ran scrapy shell on a page which was supposed to be parsed into an item and this is what I got:

In [16]: item = spider.parse_app(response)

In [17]: item.fields
Out[17]: {'desc': {}, 'name': {}, 'url': {}}

In [18]: item['name']
Out[18]: u'Die Kleine Meerjungfrau'

What? Either I’m doing something completely wrong (I did everything like the official tutorials and examples told me) or Field being a dict is totally pointless.

Can someone explain that to me?

  • 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-06-18T22:29:54+00:00Added an answer on June 18, 2026 at 10:29 pm

    Historical reasons. There used to be metadata attached to the fields which was stored in the dict. I assume a dict was used because it has a convenient (key=value) constructor. You can see that the last use of this was removed in this commit. At this point it makes very little difference and it could just be a plain object (although changing could be difficult if there’s still code out there which assumes it’s a dict for some reason).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an MVC solution setup like this, with three 'projects'. Web (MVC Project,
I basically have three tables, posts, images and postimages (this simply contains the ids
I have a really simple Rails app. Basically an article with comments. I want
I'm at my wits end, and it's probably something really simple. Basically I've have
I basically have a program that filters records from one excel file to another
Basically, what the title says. I have several properties that combine together to really
I have a code pattern which translates one integer to another. Just like this:
We have a really simple URL rewrite rule that basically causes a 301 redirect
So I am basically looking for ideas here. I've never really had to do
I have written this code to check for a particular string from a file.

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.