lollyz_2019
lollyz_2019

Reputation: 61

Python: Running wget command results in it ignoring anything atter the hash in URL

I'm calling the command here for wget for url http://pypi.org/project/pip/#files

    self.run_command('("wget http://pypi.org/project/pip/\#files -O index1.html")')

My log thinks that im running it without anything from hash onward

2020-01-27 11:37:23,128 020776:084 INFO:  wget http://pypi.org/project/pip/

Ive tried it without the quotes, brackets and escape characters but get same result. Anyone have any idea?

Upvotes: 0

Views: 108

Answers (1)

MrTux
MrTux

Reputation: 34002

The hash is interpreted as the comment char on the CLI and, therefore, everything after it is ignored.

In an URL the hash indicates an anchor to which the browser should scroll. In the URL definition in RFC3986 it is written, that the hash part (called fragment) is never transmitted to the server. I.e., you can savely drop it from the URL and just use:

self.run_command('("wget http://pypi.org/project/pip/ -O index1.html")')

Besides that: 1. Why not use the HTTP interface of python directly (instead of spawning processes)? 2. Why not use the PIP API directly?

Upvotes: 1

Related Questions