Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

robots.sitemaps is a map object instead of a list #109

Open
gk1544 opened this issue Mar 21, 2019 · 2 comments · May be fixed by #114
Open

robots.sitemaps is a map object instead of a list #109

gk1544 opened this issue Mar 21, 2019 · 2 comments · May be fixed by #114

Comments

@gk1544
Copy link

gk1544 commented Mar 21, 2019

type(robots.sitemaps) is <class 'map'> instead of list (as described in README).

Why is that so?

import reppy

url = 'http://www.google.com/'
robots_url = reppy.Robots.robots_url(url)
robots = reppy.Robots.fetch(robots_url)
sitemaps = robots.sitemaps
print(type(sitemaps))
# <class 'map'>
@dlecocq
Copy link
Contributor

dlecocq commented Mar 25, 2019

Because we wrote it mostly for python 2.7, where map returns a list. In python 3, however, map returns an iterable map object (https://docs.python.org/3/library/functions.html#map). If you need a list, you could just pass the result to list.

As far as the type of sitemaps, I'd be content if it were explicitly made a list, though.

@wumpus wumpus linked a pull request Sep 9, 2019 that will close this issue
@wumpus
Copy link
Contributor

wumpus commented Sep 9, 2019

FYI the change of map() to not be a list was in python 3.6 and later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants