Skip to content

Instantly share code, notes, and snippets.

@wcaleb
Last active December 29, 2020 06:55
Show Gist options
  • Save wcaleb/218d210687546c8efd0a to your computer and use it in GitHub Desktop.
Save wcaleb/218d210687546c8efd0a to your computer and use it in GitHub Desktop.

Revisions

  1. wcaleb revised this gist Oct 22, 2015. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion waybackup.py
    Original file line number Diff line number Diff line change
    @@ -10,4 +10,6 @@
    if r.status_code == requests.codes.ok:
    print base_url + r.headers['content-location']
    else:
    print 'Error in response: ' + str(r.status_code)
    print 'Error in response: ' + str(r.status_code)
    # or you could just return the original url
    # print sys.argv[1]
  2. wcaleb revised this gist Oct 22, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion waybackup.py
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    import sys, requests

    # Usage: Pass URL to script, get back URL to Wayback Machine snapshots
    # Usage: Pass URL to script, get back URL to Wayback Machine snapshot

    base_url = 'http://web.archive.org'
    r = requests.get(base_url + '/save/' + sys.argv[1])
  3. wcaleb created this gist Oct 22, 2015.
    13 changes: 13 additions & 0 deletions waybackup.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    #! /usr/bin/env python

    import sys, requests

    # Usage: Pass URL to script, get back URL to Wayback Machine snapshots

    base_url = 'http://web.archive.org'
    r = requests.get(base_url + '/save/' + sys.argv[1])

    if r.status_code == requests.codes.ok:
    print base_url + r.headers['content-location']
    else:
    print 'Error in response: ' + str(r.status_code)