Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi all! We have been experiencing an issue on site where threads have been missing the latest postings. The platform host Vanilla are working on this issue. A workaround that has been used by some is to navigate back from 1 to 10+ pages to re-sync the thread and this will then show the latest posts. Thanks, Mike.
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Wget with url with hash - how to process it in python

  • 27-01-2020 12:57pm
    #1
    Registered Users, Registered Users 2 Posts: 5,600 ✭✭✭


    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 i'm running it without anything from hash onward
    2020-01-27 11:37:23,128 020776:084 INFO:  wget http://pypi.org/project/pip/
    

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


Comments

  • Registered Users, Registered Users 2 Posts: 6,236 ✭✭✭Idleater


    Have a look at urlencode


  • Registered Users, Registered Users 2 Posts: 885 ✭✭✭clearz


    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 i'm running it without anything from hash onward
    2020-01-27 11:37:23,128 020776:084 INFO:  wget http://pypi.org/project/pip/
    

    I've tried it without the quotes, brackets and escape characters but get same result. Anyone have any idea?
    http://pypi.org/project/pip/%23files
    
    should work. If not try curl instead of wget if it's installed

    I don’t know much about the python standard library but I’d be positive there are classes available for downloading data from the web. This would be a safer and cleaner bet than calling system apps like wget.

    The hash symbol is usually used on the client side as part of a JavaScript app so even if you get it to work, what downloads might not be what you expected.


  • Registered Users, Registered Users 2 Posts: 7,157 ✭✭✭srsly78


    OP just use a raw string.

    rawstring = r"whatever"

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


  • Registered Users, Registered Users 2 Posts: 885 ✭✭✭clearz


    srsly78 wrote: »
    OP just use a raw string.

    rawstring = r"whatever"

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


    Won't make a difference. This is not an 'issue' with python but with the wget application.

    EDIT:

    Everything related to this can be found here in the source for wget
    http://git.savannah.gnu.org/cgit/wget.git/tree/src/url.c
    To get started: Anywhere you can find the string 'fragment' in the above code is of interest

    This led me to search google for "wget fragment" which contins plenty of relevant information.


Advertisement