jjjake / internetarchive

A Python and Command-Line Interface to Archive.org
GNU Affero General Public License v3.0
1.61k stars 218 forks source link

ConnectionError on upload #47

Closed joepie91 closed 10 years ago

joepie91 commented 10 years ago

I've been working on a script to automatically upload recorded livesets to the Internet Archive, but I've been running into a ConnectionError exception while doing so, and I've been unable to figure out what is causing it.

I've been attempting to run this several times during the past few weeks, thinking it might just be a network issue, but the issue always occurs for this script. Another script I run on the same server, for automatically uploading scraped pastes from Pastebin, works just fine. Is there something I'm doing wrong, or is this a bug?

This is what happens:

stream@croissant:~$ python upload.py sorted/
Traceback (most recent call last): THE BLEND TECHNOTERRA SOUNDSYSTEM GROSSETO.mp3: [                                ] 19/219327 - 00:00:00
  File "upload.py", line 72, in <module>
    item.upload([mp3_filename, json_filename], metadata=headers, verbose=True)
  File "/usr/local/lib/python2.7/dist-packages/internetarchive/item.py", line 433, in upload
    resp = self.upload_file(f, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/internetarchive/item.py", line 386, in upload_file
    return self.session.send(prepared_request, stream=True)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 486, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 382, in send
    raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='s3.us.archive.org', port=80): Max retries exceeded with url: /TEST-Technoterra-Live_THE_BLEND_TECHNOTERRA_SOUNDSYSTEM_GROSSETO-28Oct2011/20111028%20-%20082053-%20Live%20THE%20BLEND%20TECHNOTERRA%20SOUNDSYSTEM%20GROSSETO.mp3 (Caused by <class 'socket.error'>: [Errno 32] Broken pipe)

This is my code:

import internetarchive, os, json, sys
import string, random, datetime, re, yaml

with open("config.yaml", "r") as f:
        config = yaml.safe_load(f)

os.environ["AWS_ACCESS_KEY_ID"] = config["s3"]["access"]
os.environ["AWS_SECRET_ACCESS_KEY"] = config["s3"]["secret"]

def parse_iso_datetime(str) :
    # parse a datetime generated by datetime.isoformat()
    # http://dwiel.net/blog/python-parsing-the-output-of-datetime-isoformat/
    try :
        return datetime.datetime.strptime(str, "%Y-%m-%dT%H:%M:%S")
    except ValueError :
        return datetime.datetime.strptime(str, "%Y-%m-%dT%H:%M:%S.%f")

def random_string(length = 12):
    return "".join(random.choice(string.lowercase) for x in xrange(0, length))

current_file = ""
sys.stdout.write("")

def urlize(text):
    text = re.sub("[^a-zA-Z0-9_-]", "_", text)
    text = re.sub("_{2,}", "_", text)
    return text

description_template = """
Liveset title: %(title)s<br>
DJ/Show: %(artist)s<br>
Broadcast started: %(date)s<br>
Station: <a href="http://afterhoursdjs.org/">AfterHoursDJs.org</a><br>
<br>
Please note that this liveset was recorded, classified, and uploaded automatically. Information may be inaccurate, and the recording may be incomplete. Please report any inaccuracies to the uploader.<br>
<br>
The classification metadata can be found in the accompanying JSON file.
"""

source_dir = sys.argv[1]
files = [os.path.join(source_dir, f) for f in os.listdir(source_dir) if os.path.isfile(os.path.join(source_dir, f)) and f.endswith(".mp3")]

for mp3_filename in files:
    json_filename =  os.path.splitext(mp3_filename)[0] + ".json"

    json_file = open(json_filename, "r")
    metadata = json.load(json_file)
    json_file.close()

    broadcast_date = parse_iso_datetime(metadata["broadcast_date"])
    bucket_name = "TEST-%s-%s-%s" % (metadata["artist"].replace(" ", ""), urlize(metadata["title"]), broadcast_date.strftime("%d%b%Y"))

    headers = {
        "mediatype": "audio",
        "collection": "afterhoursdjs_livesets",
        "subject": ["AfterHoursDJs.org", "liveset", metadata["artist"], broadcast_date.year, "test_collection"],
        "title": "%s (%s, %s)" % (metadata["title"], metadata["artist"], broadcast_date.strftime("%d %b %Y")),
        "description": description_template % {
            "title": metadata["title"],
            "artist": metadata["artist"],
            "date": broadcast_date.strftime("%d %B %Y, %H:%M:%S")
        }
    }

    item = internetarchive.Item(bucket_name)

    if item.exists:
        print "Skipping %s, already exists..." % bucket_name
        continue
    else:
        # Item does not exist yet, upload...
                item.upload(mp3_filename, metadata=headers, verbose=True)
                item.upload(json_filename, verbose=True)

This is what is in said directory:

stream@croissant:~$ ls sorted
20090801 - Misjah In The Mix.json                                     20101226 - 054733- Live LRCN ChillTemp01.mp3
20090801 - Misjah In The Mix.mp3                                      20101226 - 080133- Live LRCN Tech Therapy 010.json
20090901 - Misjah In The Mix.json                                     20101226 - 080133- Live LRCN Tech Therapy 010.mp3
20090901 - Misjah In The Mix.mp3                                      20101228 - 090420- Live Mash D Random Music.json
20091204 - 080400- Live The Live Blend technoterra LIVE 04 12 2009.json                   20101228 - 090420- Live Mash D Random Music.mp3
20091204 - 080400- Live The Live Blend technoterra LIVE 04 12 2009.mp3                    20110103 - 105213- Live RaveOlution 50 with DJ Teknikal Crysis.json
20091230 - 161109- Live Bass Attack V with DJs G LuX and CB SoundZ.json                   20110103 - 105213- Live RaveOlution 50 with DJ Teknikal Crysis.mp3
20091230 - 161109- Live Bass Attack V with DJs G LuX and CB SoundZ.mp3                    20110106 - 191317- Live Jake Encinas Live from Minneapolis.json
20091230 - 193710- Live SinCitySyndicate presents DJ Neuro.json                       20110106 - 191317- Live Jake Encinas Live from Minneapolis.mp3
20091230 - 193710- Live SinCitySyndicate presents DJ Neuro.mp3                        20110110 - 093123- Live TonY Presents Club Beats.json
20100104 - 193934- Live Teknofunk w DJ Jakub.json                             20110110 - 093123- Live TonY Presents Club Beats.mp3
20100104 - 193934- Live Teknofunk w DJ Jakub.mp3                              20110113 - 130058- Live Moments of joy with Delune x11 Session 2.json
20100108 - 192245- Live DJ TAD Satech 3.json                                  20110113 - 130058- Live Moments of joy with Delune x11 Session 2.mp3
20100108 - 192245- Live DJ TAD Satech 3.mp3                               20110115 - 130431- Live The Bidness 069 January 2011 with D Trax and LRCN.json
20100109 - 095900- Live RaveOlution Episode 27 Teknikal Crysis.json                   20110115 - 130431- Live The Bidness 069 January 2011 with D Trax and LRCN.mp3
20100109 - 095900- Live RaveOlution Episode 27 Teknikal Crysis.mp3                    20110122 - 120742- Live The Truth w Kegan EP 82.json
20100114 - 230226- Live Jake Encinas Live.json                                20110122 - 120742- Live The Truth w Kegan EP 82.mp3
20100114 - 230226- Live Jake Encinas Live.mp3                                 20110302 - 171341- Live DJ TAD PROTRONIC EP 58.json
20100115 - 110623- Live Sick Note SmackHI chapter 26 LiVe IT.json                     20110302 - 171341- Live DJ TAD PROTRONIC EP 58.mp3
20100115 - 110623- Live Sick Note SmackHI chapter 26 LiVe IT.mp3                      20110323 - 170016- Live DJ TAD Protronic 61.json
20100115 - 165243- Live The Truth w Kegan Episode 68 Yeah its for real.json               20110323 - 170016- Live DJ TAD Protronic 61.mp3
20100115 - 165243- Live The Truth w Kegan Episode 68 Yeah its for real.mp3                20110415 - 153002- Live Moments of joy with Delune x11 Session 8.json
20100115 - 204501- Live Justin Styles Live from the W Hotel Minneapolis.json                  20110415 - 153002- Live Moments of joy with Delune x11 Session 8.mp3
20100115 - 204501- Live Justin Styles Live from the W Hotel Minneapolis.mp3               20110420 - 183111- Live DJ TAD Protronic 64 PT2.json
20100116 - 104059- Live Gabriel Setis Tribute to Melody 47 LIVE w Stickam Join the IRC for Info.json  20110420 - 183111- Live DJ TAD Protronic 64 PT2.mp3
20100116 - 104059- Live Gabriel Setis Tribute to Melody 47 LIVE w Stickam Join the IRC for Info.mp3   20110422 - 081242- Live THE BLEND the sound of technoterra.json
20100120 - 212947- Live Jake Encinas Live.json                                20110422 - 081242- Live THE BLEND the sound of technoterra.mp3
20100120 - 212947- Live Jake Encinas Live.mp3                                 20110424 - 132410- Live Moments of Joy easter edit with Delune.json
20100123 - 162957- Live Patrick Kroft LIVE.json                               20110424 - 132410- Live Moments of Joy easter edit with Delune.mp3
20100123 - 162957- Live Patrick Kroft LIVE.mp3                                20110427 - 172336- Live DJ TAD Protronic 65.json
20100123 - 184255- Live Sub Assassins Studios.json                            20110427 - 172336- Live DJ TAD Protronic 65.mp3
20100123 - 184255- Live Sub Assassins Studios.mp3                             20110429 - 081626- Live TECHNOTERRA THE BLEND 29april2011.json
20100212 - 011436- Live Moments of Joy Wake up tunes with Delune.json                     20110429 - 081626- Live TECHNOTERRA THE BLEND 29april2011.mp3
20100212 - 011436- Live Moments of Joy Wake up tunes with Delune.mp3                      20110513 - 091155- Live TECHNOTERRA THE BLEND 13 05 2011.json
20100215 - 100456- Live Patrick Kroft.json                                20110513 - 091155- Live TECHNOTERRA THE BLEND 13 05 2011.mp3
20100215 - 100456- Live Patrick Kroft.mp3                                 20110514 - 111133- Live The Truth w Kegan EP 93.json
20100219 - 171419- Live The Truth w kegan Ep 73.json                              20110514 - 111133- Live The Truth w Kegan EP 93.mp3
20100219 - 171419- Live The Truth w kegan Ep 73.mp3                           20110525 - 192439- Live DJ TAD EP 69 PT 2.json
20100220 - 122103- Live SinCitySyndicate presents DJ Neuro LIVE.json                      20110525 - 192439- Live DJ TAD EP 69 PT 2.mp3
20100220 - 122103- Live SinCitySyndicate presents DJ Neuro LIVE.mp3                   20110603 - 083138- Live TECHNOTERRA THE BLEND 02 JUNE 2011.json
20100223 - 093337- Live Stephen Wiley.json                                20110603 - 083138- Live TECHNOTERRA THE BLEND 02 JUNE 2011.mp3
20100223 - 093337- Live Stephen Wiley.mp3                                 20110603 - 093916- Live TECHNOTERRA THE BLEND 02 JUNE 2011.json
20100312 - 212521- Live Jake Encinas Live.json                                20110603 - 093916- Live TECHNOTERRA THE BLEND 02 JUNE 2011.mp3
20100312 - 212521- Live Jake Encinas Live.mp3                                 20110624 - 092712- Live TECHNOTERRA THE BLEND 24 JUNE 2011.json
20100313 - 180519- Live DJ Teknikal Crysis The RaveOlution Episode 32.json                20110624 - 092712- Live TECHNOTERRA THE BLEND 24 JUNE 2011.mp3
20100313 - 180519- Live DJ Teknikal Crysis The RaveOlution Episode 32.mp3                 20110701 - 080221- Live TECHNOTERRA THE BLEND 01 JULY 2011.json
20100315 - 154833- Live TumTum Random Selctions 2010.json                         20110701 - 080221- Live TECHNOTERRA THE BLEND 01 JULY 2011.mp3
20100315 - 154833- Live TumTum Random Selctions 2010.mp3                          20110706 - 170543- Live DJ TAD Protronic 73.json
20100321 - 171750- Live Prognosis Live with Jake Encinas and Sean Merrell.json                20110706 - 170543- Live DJ TAD Protronic 73.mp3
20100321 - 171750- Live Prognosis Live with Jake Encinas and Sean Merrell.mp3                 20110711 - 061122- Live Moments of joy with Delune x11 Session 9.json
20100325 - 224843- Live Jake Encinas.json                                 20110711 - 061122- Live Moments of joy with Delune x11 Session 9.mp3
20100325 - 224843- Live Jake Encinas.mp3                                  20110730 - 125931- Live Mash D ElectroNight 48.json
20100331 - 111019- Live Moments of Joy with Delune Episode 63.json                    20110730 - 125931- Live Mash D ElectroNight 48.mp3
20100331 - 111019- Live Moments of Joy with Delune Episode 63.mp3                     20110802 - 145215- Live Mash D ElectroNight 48.json
20100405 - 155343- Live Hubris Sessions with Justin Sytles.json                       20110802 - 145215- Live Mash D ElectroNight 48.mp3
20100405 - 155343- Live Hubris Sessions with Justin Sytles.mp3                        20110908 - 085508- Live Moments of Joy with Delune 08 09 11.json
20100408 - 165549- Live The RaveOlution Episode 33 with DJ Teknikal Crysis.json               20110908 - 085508- Live Moments of Joy with Delune 08 09 11.mp3
20100408 - 165549- Live The RaveOlution Episode 33 with DJ Teknikal Crysis.mp3                20110909 - 133401- Live Mike Hunter and Ciacomix from Germany.json
20100408 - 190124- Live DJ TAD Rock The Vote Ep 4 www djtad com vote.json                 20110909 - 133401- Live Mike Hunter and Ciacomix from Germany.mp3
20100408 - 190124- Live DJ TAD Rock The Vote Ep 4 www djtad com vote.mp3                  20110911 - 114806- Live Setis September 2011 Promo.json
20100409 - 172025- Live DJ TAD Rock The Vote Ep 5 www djtad com vote.json                 20110911 - 114806- Live Setis September 2011 Promo.mp3
20100409 - 172025- Live DJ TAD Rock The Vote Ep 5 www djtad com vote.mp3                  20110912 - 085706- Live Darthiis Electro House Session 19.json
20100416 - 133929- Live Moments of Joy with Delune the weekend edition.json               20110912 - 085706- Live Darthiis Electro House Session 19.mp3
20100416 - 133929- Live Moments of Joy with Delune the weekend edition.mp3                20110918 - 085712- Live w a r m d i g i t s technoterra soundsystem EXTRA 18 08 2011.json
20100416 - 225413- Live Jake Encinas ALL VINYL ALL OLD SCHOOL.json                    20110918 - 085712- Live w a r m d i g i t s technoterra soundsystem EXTRA 18 08 2011.mp3
20100416 - 225413- Live Jake Encinas ALL VINYL ALL OLD SCHOOL.mp3                     20110921 - 191036- Live DJ TAD Protronic 77.json
20100420 - 160422- Live 24 hour live dirty sexy set by betamaxdj.json                     20110921 - 191036- Live DJ TAD Protronic 77.mp3
20100420 - 160422- Live 24 hour live dirty sexy set by betamaxdj.mp3                      20110923 - 084348- Live The blend technoterra 23 09 2011.json
20100428 - 193139- Live The Root Cause with Sean Merrell.json                         20110923 - 084348- Live The blend technoterra 23 09 2011.mp3
20100428 - 193139- Live The Root Cause with Sean Merrell.mp3                          20110926 - 085923- Live Darthii s Electro House Session 21.json
20100709 - 084615- Live technoterra.json                                  20110926 - 085923- Live Darthii s Electro House Session 21.mp3
20100709 - 084615- Live technoterra.mp3                                   20111001 - 095301- Live Mash D ElectroNight 56 p2.json
20100709 - 110433- Live DJ Mash D s Sunshine and Tribal mix from Germany.json                 20111001 - 095301- Live Mash D ElectroNight 56 p2.mp3
20100709 - 110433- Live DJ Mash D s Sunshine and Tribal mix from Germany.mp3                  20111005 - 190001- Live DJ TAD Protronic 78.json
20100716 - 110252- Live HandzUp for the weekend with DJ Mash D.json                   20111005 - 190001- Live DJ TAD Protronic 78.mp3
20100716 - 110252- Live HandzUp for the weekend with DJ Mash D.mp3                    20111007 - 083614- Live theBlend TECHNOTERRA SoundSystem 07 10 2011.json
20100724 - 000244- Live Sub Assassins We ate a bunch of mushrooms.json                    20111007 - 083614- Live theBlend TECHNOTERRA SoundSystem 07 10 2011.mp3
20100724 - 000244- Live Sub Assassins We ate a bunch of mushrooms.mp3                     20111008 - 090307- Live Mash D ElectroNight 57.json
20100725 - 134805- Live SinCitySyndicate weekly LIVE radio show w DJ Neuro.json               20111008 - 090307- Live Mash D ElectroNight 57.mp3
20100725 - 134805- Live SinCitySyndicate weekly LIVE radio show w DJ Neuro.mp3                20111010 - 114200- Live Moments of Joy with Delune 10 10 11.json
20100726 - 101446- Live Moments of Joy with Delune August.json                        20111010 - 114200- Live Moments of Joy with Delune 10 10 11.mp3
20100726 - 101446- Live Moments of Joy with Delune August.mp3                         20111015 - 115050- Live Moments of Joy weekendmix 15 10 11.json
20100802 - 185153- Live Teknofunk with DJ Jakub.json                              20111015 - 115050- Live Moments of Joy weekendmix 15 10 11.mp3
20100802 - 185153- Live Teknofunk with DJ Jakub.mp3                           20111021 - 071706- Live Moments of Joy Weekend edition 211011.json
20100803 - 123616- Live Little B Day Mix by Mash D part 2.json                        20111021 - 071706- Live Moments of Joy Weekend edition 211011.mp3
20100803 - 123616- Live Little B Day Mix by Mash D part 2.mp3                         20111021 - 083509- Live technoTerra SoundSystem theBlend 21 10 2011.json
20100803 - 180401- Live Happy Birthday to Mash D w DJ Teknikal Crysis.json                20111021 - 083509- Live technoTerra SoundSystem theBlend 21 10 2011.mp3
20100803 - 180401- Live Happy Birthday to Mash D w DJ Teknikal Crysis.mp3                 20111022 - 125716- Live Mash D ElectroNight 58.json
20100804 - 194038- Live The Root Cause Episode 6 w Sean Merrell.json                      20111022 - 125716- Live Mash D ElectroNight 58.mp3
20100804 - 194038- Live The Root Cause Episode 6 w Sean Merrell.mp3                   20111023 - 083023- Live the WARM DIGITS session 23 10 2011.json
20100806 - 143853- Live Vale In The Mix.json                                  20111023 - 083023- Live the WARM DIGITS session 23 10 2011.mp3
20100806 - 143853- Live Vale In The Mix.mp3                               20111023 - 140207- Live SinCitySyndicate Weekly with DJ Neuro and more.json
20100820 - 082539- Live the blend technoterra 20 08 2010.json                         20111023 - 140207- Live SinCitySyndicate Weekly with DJ Neuro and more.mp3
20100820 - 082539- Live the blend technoterra 20 08 2010.mp3                          20111028 - 082053- Live THE BLEND TECHNOTERRA SOUNDSYSTEM GROSSETO.json
20100820 - 130339- Live Teknofunk with DJ Jakub.json                              20111028 - 082053- Live THE BLEND TECHNOTERRA SOUNDSYSTEM GROSSETO.mp3
20100820 - 130339- Live Teknofunk with DJ Jakub.mp3                           20111109 - 191241- Live DJ TAD Protronic 82.json
20100822 - 130709- Live Sin City Syndicate Weekly Radio Show with DJ Neuro.json               20111109 - 191241- Live DJ TAD Protronic 82.mp3
20100822 - 130709- Live Sin City Syndicate Weekly Radio Show with DJ Neuro.mp3                20111111 - 082931- Live T H E B L E N D TECHNOTERRA 11 11 2011.json
20100825 - 171323- Live DJ TAD Protronic 35.json                              20111111 - 082931- Live T H E B L E N D TECHNOTERRA 11 11 2011.mp3
20100825 - 171323- Live DJ TAD Protronic 35.mp3                               20111118 - 081539- Live the blend technoterra soundSystem 18 11 2011.json
20100825 - 182613- Live DJ TAD Protronic 35 part2.json                            20111118 - 081539- Live the blend technoterra soundSystem 18 11 2011.mp3
20100825 - 182613- Live DJ TAD Protronic 35 part2.mp3                             20111119 - 110217- Live Mash D ElectroNight 61.json
20100903 - 120346- Live teknofunk w dj jakub.json                             20111119 - 110217- Live Mash D ElectroNight 61.mp3
20100903 - 120346- Live teknofunk w dj jakub.mp3                              20111130 - 190203- Live DJ TAD Protronic 85.json
20100903 - 180646- Live Moments of Joy midnightmix september with Delune.json                 20111130 - 190203- Live DJ TAD Protronic 85.mp3
20100903 - 180646- Live Moments of Joy midnightmix september with Delune.mp3                  20111203 - 110427- Live Mash D ElectroNight 63.json
20100906 - 211022- Live The Red Bull Effect with Justin Styles.json                   20111203 - 110427- Live Mash D ElectroNight 63.mp3
20100906 - 211022- Live The Red Bull Effect with Justin Styles.mp3                    20111207 - 190005- Live DJ TAD Protronic 86.json
20100907 - 094240- Live brunch with betamaxDj dirty sexy house.json                   20111207 - 190005- Live DJ TAD Protronic 86.mp3
20100907 - 094240- Live brunch with betamaxDj dirty sexy house.mp3                    20111209 - 120025- Live Ciacomix from Germany Past Present Future.json
20100909 - 213427- Live Jake Encinas.json                                 20111209 - 120025- Live Ciacomix from Germany Past Present Future.mp3
20100909 - 213427- Live Jake Encinas.mp3                                  20111211 - 140012- Live Sin City Syndicate Weekly with DJ Neuro and Pyro Tech.json
20100910 - 083215- Live The blend technoterra 10 09 2010.json                         20111211 - 140012- Live Sin City Syndicate Weekly with DJ Neuro and Pyro Tech.mp3
20100910 - 083215- Live The blend technoterra 10 09 2010.mp3                          20111212 - 170405- Live The House of Styles Episode 001 with Sean Merrell.json
20100912 - 130057- Live SinCitySynidcate Weekly Radio Show and House Party with DJ Neuro.json         20111212 - 170405- Live The House of Styles Episode 001 with Sean Merrell.mp3
20100912 - 130057- Live SinCitySynidcate Weekly Radio Show and House Party with DJ Neuro.mp3          20111217 - 133152- Live Ciacomix Birthday Pary from Germany.json
20100917 - 103958- Live Sick Note aka Ganzak SmackHI chapter 35 LiVe IT.json                  20111217 - 133152- Live Ciacomix Birthday Pary from Germany.mp3
20100917 - 103958- Live Sick Note aka Ganzak SmackHI chapter 35 LiVe IT.mp3               20111225 - 140113- Live SinCitySyndicate Weekly Xmas 2012 Special with DJ Neuro.json
20100918 - 085344- Live ElectroNight 13 with Mash D from Germany.json                     20111225 - 140113- Live SinCitySyndicate Weekly Xmas 2012 Special with DJ Neuro.mp3
20100918 - 085344- Live ElectroNight 13 with Mash D from Germany.mp3                      20111231 - 211325- Live Welcome to 2012 w Gabriel Setis.json
20100924 - 091430- Live The blend technoterra 24 09 2010.json                         20111231 - 211325- Live Welcome to 2012 w Gabriel Setis.mp3
20100924 - 091430- Live The blend technoterra 24 09 2010.mp3                          20111231 - 211522- Live Welcome to 2012 w Gabriel Setis.json
20100929 - 155627- Live The RaveOlution Episode 44 w DJ Teknikal Crysis www teknikalcrysis com.json   20111231 - 211522- Live Welcome to 2012 w Gabriel Setis.mp3
20100929 - 155627- Live The RaveOlution Episode 44 w DJ Teknikal Crysis www teknikalcrysis com.mp3    20120106 - 080034- Live TECHNOTERRA SOUNDSYSTEM 06 JAN 2012.json
20100930 - 210654- Live Jake Encinas.json                                 20120106 - 080034- Live TECHNOTERRA SOUNDSYSTEM 06 JAN 2012.mp3
20100930 - 210654- Live Jake Encinas.mp3                                  20120109 - 091024- Live TonY Presents Club Beats http tonil arkku net.json
20101002 - 110139- Live Moments of Joy with Delune October 2010.json                      20120109 - 091024- Live TonY Presents Club Beats http tonil arkku net.mp3
20101002 - 110139- Live Moments of Joy with Delune October 2010.mp3                   20120115 - 140037- Live SinCitySyndicate Weekly with DJ Neuro and JusJoshua.json
20101008 - 082719- Live technoterra the blend 08 10 2010.json                         20120115 - 140037- Live SinCitySyndicate Weekly with DJ Neuro and JusJoshua.mp3
20101008 - 082719- Live technoterra the blend 08 10 2010.mp3                          20120118 - 110845- Live Mash D ElectroNight 65.json
20101008 - 104224- Live Sick Note aka Ganzak SmackHI chapter 37 LiVe IT.json                  20120118 - 110845- Live Mash D ElectroNight 65.mp3
20101008 - 104224- Live Sick Note aka Ganzak SmackHI chapter 37 LiVe IT.mp3               20120122 - 111942- Live Mash D in the mix recorded live at saltandpepper.json
20101008 - 151235- Live Moments of Joy with Delune Midnight Sessions 01.json                  20120122 - 111942- Live Mash D in the mix recorded live at saltandpepper.mp3
20101008 - 151235- Live Moments of Joy with Delune Midnight Sessions 01.mp3               20120122 - 140014- Live Neurology Weekly with DJ Neuro and Stephen Wiley.json
20101016 - 164845- Live The Bidness 064 August 2010 P2 Geoff Ledak.json                   20120122 - 140014- Live Neurology Weekly with DJ Neuro and Stephen Wiley.mp3
20101016 - 164845- Live The Bidness 064 August 2010 P2 Geoff Ledak.mp3                    20120128 - 070245- Live Moments of Joy Februari 2012.json
20101017 - 140551- Live SinCitySyndicate show w DJ Neuro Chris Smotherman.json                20120128 - 070245- Live Moments of Joy Februari 2012.mp3
20101017 - 140551- Live SinCitySyndicate show w DJ Neuro Chris Smotherman.mp3                 20120206 - 171205- Live The House of Styles with guest K Drive.json
20101022 - 144629- Live Moments of joy with Delune 221010.json                        20120206 - 171205- Live The House of Styles with guest K Drive.mp3
20101022 - 144629- Live Moments of joy with Delune 221010.mp3                         20120208 - 190541- Live DJ TAD Protronic Japan.json
20101025 - 203834- Live The Red Bull Effect with Justin Styles.json                   20120208 - 190541- Live DJ TAD Protronic Japan.mp3
20101025 - 203834- Live The Red Bull Effect with Justin Styles.mp3                    20120212 - 140140- Live Neurology Weekly with DJ Neuro.json
20101029 - 120853- Live Teknofunk w Killer Meph.json                              20120212 - 140140- Live Neurology Weekly with DJ Neuro.mp3
20101029 - 120853- Live Teknofunk w Killer Meph.mp3                           20120228 - 111803- Live Mash D ElectroNight 66.json
20101030 - 111456- Live Tribute to Melody 57 w Gabriel Setis.json                     20120228 - 111803- Live Mash D ElectroNight 66.mp3
20101030 - 111456- Live Tribute to Melody 57 w Gabriel Setis.mp3                      20120301 - 055715- Live Moments of Joy March edition 2012 with Delune.json
20101031 - 120000- Live Happy Halloween 2k10 from Mash D.json                         20120301 - 055715- Live Moments of Joy March edition 2012 with Delune.mp3
20101031 - 120000- Live Happy Halloween 2k10 from Mash D.mp3                          20120307 - 190222- Live DJ TAD Protronic 94.json
20101101 - 010756- Live MrHat Halloween.json                                  20120307 - 190222- Live DJ TAD Protronic 94.mp3
20101101 - 010756- Live MrHat Halloween.mp3                               20120312 - 101207- Live TonY Presents Club Beats http tonil arkku net.json
20101102 - 110703- Live Mash D playing House Music for you.json                       20120312 - 101207- Live TonY Presents Club Beats http tonil arkku net.mp3
20101102 - 110703- Live Mash D playing House Music for you.mp3                        20120316 - 085117- Live TECHNOTERRA SOUNDSYSTEM 16 02 2012.json
20101102 - 130633- Live betamaxdj extended tuesday disco tunez.json                   20120316 - 085117- Live TECHNOTERRA SOUNDSYSTEM 16 02 2012.mp3
20101102 - 130633- Live betamaxdj extended tuesday disco tunez.mp3                    20120325 - 140016- Live Neurology Weekly with DJ Neuro and Slinky.json
20101103 - 170811- Live DJ TAD Protronic 43.json                              20120325 - 140016- Live Neurology Weekly with DJ Neuro and Slinky.mp3
20101103 - 170811- Live DJ TAD Protronic 43.mp3                               20120330 - 073142- Live TECHNOTERRA SOUNDSYSTEM 30 03 2012.json
20101107 - 100841- Live HouseMouse EP3 w Delune and Mash D.json                       20120330 - 073142- Live TECHNOTERRA SOUNDSYSTEM 30 03 2012.mp3
20101107 - 100841- Live HouseMouse EP3 w Delune and Mash D.mp3                        20120408 - 121626- Live Ciacomix from Germany Pres Easter Egg Trance.json
20101110 - 171411- Live DJ TAD Protronic 44.json                              20120408 - 121626- Live Ciacomix from Germany Pres Easter Egg Trance.mp3
20101110 - 171411- Live DJ TAD Protronic 44.mp3                               20120408 - 140356- Live Neurology Weekly with DJ Neuro.json
20101113 - 200540- Live Jake Encinas from Minneapolis.json                        20120408 - 140356- Live Neurology Weekly with DJ Neuro.mp3
20101113 - 200540- Live Jake Encinas from Minneapolis.mp3                         20120409 - 170734- Live The House of Styles with Chico Brown.json
20101114 - 141941- Live SinCitySyndicate weekly w Ashley Power.json                   20120409 - 170734- Live The House of Styles with Chico Brown.mp3
20101114 - 141941- Live SinCitySyndicate weekly w Ashley Power.mp3                    20120413 - 075745- Live the Worldwide Session technoterra 13 04 2012.json
20101120 - 092726- Live DJ Mash D Trance Time EN 22.json                          20120413 - 075745- Live the Worldwide Session technoterra 13 04 2012.mp3
20101120 - 092726- Live DJ Mash D Trance Time EN 22.mp3                           20120422 - 140018- Live Neurology Weekly with DJ Neuro.json
20101120 - 114604- Live Tribute to Melody 59 w Gabriel Setis.json                     20120422 - 140018- Live Neurology Weekly with DJ Neuro.mp3
20101120 - 114604- Live Tribute to Melody 59 w Gabriel Setis.mp3                      20120515 - 073454- Live the warm digits session technoterra 15 may 2012.json
20101128 - 141605- Live DJ Neuro Weekly SCS Show.json                             20120515 - 073454- Live the warm digits session technoterra 15 may 2012.mp3
20101128 - 141605- Live DJ Neuro Weekly SCS Show.mp3                              20120523 - 110007- Live Mash D Kinda Random.json
20101201 - 224939- Live The Red Bull Effect with Justin Styles twitter com trahma.json            20120523 - 110007- Live Mash D Kinda Random.mp3
20101201 - 224939- Live The Red Bull Effect with Justin Styles twitter com trahma.mp3             20120525 - 105000- Live SickNote themes fron the black forest 25 05 2012.json
20101204 - 151025- Live Back on track Ciacomix from Germany.json                      20120525 - 105000- Live SickNote themes fron the black forest 25 05 2012.mp3
20101204 - 151025- Live Back on track Ciacomix from Germany.mp3                       20120531 - 235222- Live technoterra the blend first of june 12.json
20101207 - 110240- Live Redlight Music with Delune.json                           20120531 - 235222- Live technoterra the blend first of june 12.mp3
20101207 - 110240- Live Redlight Music with Delune.mp3                            20120601 - 140840- Live Moments of Joy June edition 2012 with Delune.json
20101207 - 220531- Live betamax from miami beach flashback afterhours.json                20120601 - 140840- Live Moments of Joy June edition 2012 with Delune.mp3
20101207 - 220531- Live betamax from miami beach flashback afterhours.mp3                 20120628 - 190425- Live DJ TAD Protronic 109.json
20101212 - 111854- Live Doktor Domi DJ presents Back To 2010.json                     20120628 - 190425- Live DJ TAD Protronic 109.mp3
20101212 - 111854- Live Doktor Domi DJ presents Back To 2010.mp3                      20120629 - 110733- Live sicknote themes from the black forest 29 june 2012.json
20101212 - 122803- Live Doktor Domi DJ presents Back To 2010.json                     20120629 - 110733- Live sicknote themes from the black forest 29 june 2012.mp3
20101212 - 122803- Live Doktor Domi DJ presents Back To 2010.mp3                      [Live!] Mash-D - Pumping Electro For Your Ears 002.json
20101212 - 140658- Live SCS Weekly Show w DJ Neuro and guest Shawn Frazier.json               [Live!] Mash-D - Pumping Electro For Your Ears 002.mp3
20101212 - 140658- Live SCS Weekly Show w DJ Neuro and guest Shawn Frazier.mp3                 - [Live!] Neurologly Weekly with NeuroUnderground.json
20101214 - 205623- Live betamaxDj live from miami happy fetivus to alll.json                   - [Live!] Neurologly Weekly with NeuroUnderground.mp3
20101214 - 205623- Live betamaxDj live from miami happy fetivus to alll.mp3                - [Live!] sick nota porngrooves Turin IT.json
20101217 - 105830- Live SickNote aka Ganzak SmackHI chapter 40 LiVe IT.json                - [Live!] sick nota porngrooves Turin IT.mp3
20101217 - 105830- Live SickNote aka Ganzak SmackHI chapter 40 LiVe IT.mp3                 - [Live!] The House of Styles with DJ Matty Matt.json
20101218 - 090421- Live ElectroNight 26 with Mash D from Germany.json                      - [Live!] The House of Styles with DJ Matty Matt.mp3
20101218 - 090421- Live ElectroNight 26 with Mash D from Germany.mp3                       - [Live!] The House of Styles with special guest Drewbinski.json
20101218 - 134853- Live LRCN Dark Planet Recorded Live at Coshland 2010 Halloween Part 1.json          - [Live!] The House of Styles with special guest Drewbinski.mp3
20101218 - 134853- Live LRCN Dark Planet Recorded Live at Coshland 2010 Halloween Part 1.mp3           - [Live!] The House of Styles with special guest Kyle_G.json
20101218 - 172008- Live Moments of joy with Delune 20101219.json                       - [Live!] The House of Styles with special guest Kyle_G.mp3
20101218 - 172008- Live Moments of joy with Delune 20101219.mp3                        - Misjah In The Mix 1110192.json
20101226 - 054733- Live LRCN ChillTemp01.json                                  - Misjah In The Mix 1110192.mp3
chfoo commented 10 years ago

I am also experiencing this problem. Here is some more info:

Command:

$ ~/.local/bin/ia upload --verbose delcampe_20140126 www.delcampe.net.1.warc.gz www.delcampe.net.2.warc.gz www.delcampe.net.3.warc.gz --metadata="title:Delcampe.net Sampler Grab (2014-01-26)" --metadata="creator:www.delcampe.net" --metadata="description:This is a sampler WARC grab of http://www.delcampe.net using Wpull. Delcampe is an auction site." --metadata="subject:archiveteam"
$ pip freeze
GnuPGInterface==0.3.2
Landscape-Client==12.05
PAM==0.4.2
PyYAML==3.10
Twisted-Core==11.1.0
apt-xapian-index==0.44
argparse==1.2.1
args==0.1.0
chardet==2.0.1
clint==0.3.3
command-not-found==0.2.44
docopt==0.6.1
httplib2==0.7.2
internetarchive==0.5.0
jsonpatch==0.4
keyring==0.9.2
language-selector==0.1
launchpadlib==1.9.12
lazr.restfulclient==0.12.0
lazr.uri==1.0.3
oauth==1.0.1
py==1.4.20
pyOpenSSL==0.12
pycrypto==2.4.1
pyserial==2.5
pytest==2.3.4
python-apt==0.8.3ubuntu7.1
python-debian==0.1.21ubuntu1
requests==2.2.0
simplejson==2.3.2
ufw==0.31.1-1
wadllib==1.3.0
wsgiref==0.1.2
zope.interface==3.6.1

Traceback:

                         ] 32281/507826 - 00 uploading www.delcampe.net.1.warc.gz: [##                              ] 32282/507826 - 00 uploading www.delcampe.net.1.warc.gz: [##                              ] 32283/507826 - 00 uploading www.delcampe.net.1.warc.gz: [##                              ] 32284/507826 - 00 uploading www.delcampe.net.1.warc.gz: [##                              ] 32285/507826 - 00 uploading www.delcampe.net.1.warc.gz: [##                              ] 32286/507826 - 00 uploading www.delcampe.net.1.warc.gz: [##                              ] 32287/507826 - 00 uploading www.delcampe.net.1.warc.gz: [##                              ] 32288/507826 - 00 uploading www.delcampe.net.1.warc.gz: [##                              ] 32289/507826 - 00 uploading www.delcampe.net.1.warc.gz: [##                              ] 32290/507826 - 00 uploading www.delcampe.net.1.warc.gz: [##                              ] 32291/507826 - 00 uploading www.delcampe.net.1.warc.gz: [##                              ] 32292/507826 - 00 uploading www.delcampe.net.1.warc.gz: [##                              ] 32293/507826 - 00 uploading www.delcampe.net.1.warc.gz: [##                              ] 32294/507826 - 00 uploading www.delcampe.net.1.warc.gz: [##                              ] 32295/507826 - 00 uploading www.delcampe.net.1.warc.gz: [##                              ] 32296/507826 - 00 uploading www.delcampe.net.1.warc.gz: [##                              ] 32297/507826 - 00 uploading www.delcampe.net.1.warc.gz: [##                              ] 32298/507826 - 00 uploading www.delcampe.net.1.warc.gz: [##                              ] 32299/507826 - 00 uploading www.delcampe.net.1.warc.gz: [##                              ] 32300/507826 - 00 uploading www.delcampe.net.1.warc.gz: [##                              ] 32301/507826 - 00 uploadi uploading www.delcampe.net.1.warc.gz: [##                              ] 3752 uploading www.delcampe.net.1.warc.gz uploading www.delcampe.net.1.warc.gz: [####                            ] 64754/507826 - Traceback (most recent call last):.gz: [####                            ] 68206/507826 - 00:03:12
  File "/home/chris/.local/bin/ia", line 9, in <module>
    load_entry_point('internetarchive==0.5.0', 'console_scripts', 'ia')()
  File "/home/chris/.local/lib/python2.7/site-packages/iacli/ia.py", line 91, in main
    ia_module.main(argv)
  File "/home/chris/.local/lib/python2.7/site-packages/iacli/ia_upload.py", line 68, in main
    response = upload(args['<identifier>'], local_file, **upload_kwargs)
  File "/home/chris/.local/lib/python2.7/site-packages/internetarchive/api.py", line 74, in upload
    return item.upload(files, **kwargs)
  File "/home/chris/.local/lib/python2.7/site-packages/internetarchive/item.py", line 433, in upload
    resp = self.upload_file(f, **kwargs)
  File "/home/chris/.local/lib/python2.7/site-packages/internetarchive/item.py", line 386, in upload_file
    return self.session.send(prepared_request, stream=True)
  File "/home/chris/.local/lib/python2.7/site-packages/requests/sessions.py", line 486, in send
    r = adapter.send(request, **kwargs)
  File "/home/chris/.local/lib/python2.7/site-packages/requests/adapters.py", line 382, in send
    raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='s3.us.archive.org', port=80): Max retries exceeded with url: /delcampe_20140126/www.delcampe.net.1.warc.gz (Caused by <class 'socket.error'>: [Errno 32] Broken pipe)
jjjake commented 10 years ago

@joepie91 & @chfoo, this looks like a transient error -- the connection to the IA-S3 API is failing. Both of your code/commands look good, I think it is simply a failure to connect to S3. The handling and error reporting should be better, hopefully I can fix this soon.

The IA-S3 API has been a bit overloaded this past week, if you continue to run into these errors I recommend waiting a bit and trying again later.

Please let me know if you continue to have issues or if it doesn't appear to be transient. I'll leave the issue open until I can get around to handling these exceptions more gracefully.

Thanks for reporting the issue!

joepie91 commented 10 years ago

It definitely does not seem to be transient; not in my case, anyway. My Pastebin scraper uses the exact same library against the exact same interface to upload an archive every night, and it works fine: https://archive.org/details/pastebinpastes

I've been attempting to run the problematic code at several points during the past few weeks, and it has failed every single time; yet, uploading Pastebin scrapes always works.

chfoo commented 10 years ago

I tried running my command again twice, a day later, and it always failed around the same percent. I uploaded using curl (with the same info in the metadata) and it finished successfully, but that was done a few hours later. I'm not sure whether it's transient in my case.

joepie91 commented 10 years ago

I should point out that my uploads fail straight-away; it doesn't fail somewhere throughout the process, as @chfoo appears to be experiencing.

chfoo commented 10 years ago

After repeatedly trying an upload throughout the day, I found out that I didn't have AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY set in my environment (because it was in a different screen session). After setting them, the uploads uploaded successfully.