IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Python Discussion :

Problème de syntax


Sujet :

Python

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Nouveau membre du Club
    Homme Profil pro
    Webmaster
    Inscrit en
    Décembre 2015
    Messages
    5
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : Belgique

    Informations professionnelles :
    Activité : Webmaster

    Informations forums :
    Inscription : Décembre 2015
    Messages : 5
    Par défaut Problème de syntax
    Bonjour,

    Je suis occupé de développé un petit tools permettant l'automatisation d'une tache sur un jeu FB, mais depuis je rencontre un problème de Syntax que je n'avais pas il y a deux jours... pourtant je ne vois pas ou j'aurais pu faire d'erreur.

    Si quelqu'un voit plus clair que moi afin de me renseigner ce serait effectivement super et m'aiderai à du coup continuer mon projet.

    -> Ce serait la ligne: 422

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    # File: j (Python 3.4)
     
    import json
    import urllib.request as urllib
    import urllib.parse as urllib
    import http.client as http
    from urllib.error import URLError, HTTPError
    import time
    import hashlib
    import sys
    dragon_heart = 'xxx'
    session_id = 'xxx'
    user_id = xxx
    realm_number = 1
    c = 1
    server = 'realm{}.c{}.castle.rykaiju.com'.format(realm_number, c)
    cookie = '__utma=54346615.1735014085.1418478784.1420098297.1420260161.37; __utmc=54346615; __utmz=54346615.1420260161.37.36.utmcsr=castle.wonderhill.com|utmccn=(referral)|utmcmd=referral|utmcct=/platforms/kabam; __utmt_~49=1; __utmt_~50=1; __utmt_~51=1; __utma=109650694.1096652092.1418485402.1420282135.1420308691.91; __utmb=109650694.6.10.1420308691; __utmc=109650694; __utmz=109650694.1420308691.91.91.utmcsr=castle.wonderhill.com|utmccn=(referral)|utmcmd=referral|utmcct=/platforms/kabam; dragons={}'.format(session_id)
    version = 'overarch'
    stdparams = 'dragon%5Fheart={0}&user%5Fid={1}&version={2}&%5Fsession%5Fid={3}&%5Fmethod=get'.format(dragon_heart, user_id, version, session_id)
    realm = 'realm{0}.c{1}.castle.rykaiju.com'.format(realm_number, c)
    location = ''
    Ttype = ''
    speedyn = 0
    job_id = 0
    operation_list = [
        'player',
        'general',
        'forge']
     
    def clear_screen(header1, subheader1 = ''):
        import os
        if os.name == 'nt':
            pass
        1('clear')
        print('\n' + header1)
        print('\n' + subheader1)
        ul = '=' * 79
        print('\n{0}\n'.format(ul))
     
     
    def status(operation):
        url = 'http://%s/api/%s.json' % (server, operation)
        i = 0
        success = False
        while success == False:
            if i >= 7:
                print('Something is wrong, please check idle, resources, speeds, queues, and internet connection.  Exiting...')
                time.sleep(3)
                sys.exit(0)
            params = '?' + stdparams + '&timestamp=' + str(int(time.time()))
            response = urllib.request.urlopen(url + params)
     
            try:
                response_json = json.loads(response.read().decode('utf8'))
            except UnicodeDecodeError:
                e = None
     
                try:
                    print('Invalid response from server:  Check your realm variables entered.')
                    time.sleep(3)
                    sys.exit(0)
                finally:
                    e = None
                    del e
     
            except KeyError:
                e = None
     
                try:
                    success = False
                    time.sleep(2)
                finally:
                    e = None
                    del e
     
            except ValueError:
                e = None
     
                try:
                    success = False
                    time.sleep(2)
                finally:
                    e = None
                    del e
     
            except HTTPError:
                e = None
     
                try:
                    print('Invalid response from server:  Check your realm variables entered.')
                    time.sleep(3)
                    sys.exit(0)
                finally:
                    e = None
                    del e
     
     
     
            try:
                success = response_json['result']['success']
                if success == False:
     
                    try:
                        n = 0
                        while n < len(response_json['result']['errors']):
                            print(response_json['result']['errors'][n])
                            n += 1
                    except KeyError:
                        e = None
     
                        try:
                            print('Failed, retrying...')
                        finally:
                            e = None
                            del e
     
                    except ValueError:
                        e = None
     
                        try:
                            print('Failed, retrying...')
                        finally:
                            e = None
                            del e
     
     
     
                time.sleep(2)
            except KeyError:
                e = None
     
                try:
                    success = False
                    time.sleep(2)
                finally:
                    e = None
                    del e
     
            except ValueError:
                e = None
     
                try:
                    success = False
                    time.sleep(2)
                finally:
                    e = None
                    del e
     
            except UnboundLocalError:
                e = None
     
                try:
                    success = False
                    time.sleep(2)
                finally:
                    e = None
                    del e
     
     
            if operation in operation_list:
                return response_json
            None += 1
        return response_json
     
    req = status('player')
    capital_id = req['cities']['capital']['id']
    location = 'spectral'
    location = req['cities'][location]['id']
    locationcap = capital_id
     
    def myajax(realm, url, params, cookie, method = 'POST'):
        commandstring = 'Draoumculiasis' + params + 'LandCrocodile' + url + 'Bevar-Asp'
        encodedcommandstring = commandstring.encode('utf8')
        shaofencodedcommandstring = hashlib.sha1(encodedcommandstring).hexdigest()
        headers = {
            'Host': realm,
            'Connection': 'keep-alive',
            'Content-Length': len(params),
            'Origin': 'http://castlemania-production.s3.amazonaws.com',
            'x-s3-aws': shaofencodedcommandstring,
            'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:30.0) Gecko/20100101 Firefox/30.0',
            'content-type': 'application/x-www-form-urlencoded',
            'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
            'Accept-Encoding': 'gzip,deflate',
            'Accept-Language': 'en-US,en;q=0.5',
            'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
            'DNT': 1,
            'Cookie': cookie }
        conn = http.client.HTTPConnection(realm, 80)
        conn.request(method, url, params, headers)
        response = conn.getresponse()
     
        try:
            jsondata = json.loads(response.read().decode('utf8'))
        except:
            print(response)
            sys.exit()
     
        conn.close()
        return jsondata
     
    built = 0
    blue_ene = 0
    bluecheck = 0
    print("Welcome to Fruit Loops' Auto Revive / clone Script")
    print(50 * '*')
    time.sleep(1)
    print('\nThis Script preserves BE Glitch\n===============================')
    time.sleep(1)
    print('\nTroops available for reviving:\n==============================')
    print('1. Arctic Leviathan     2. Battle Dragon  3. Dragon Rider')
    print('4. Sand Strider         5. Fire Mirror    6. Giants')
    print('7: Pack Dragon          8. Dimensional R. 9. Soul Reaper')
    print('10:Fangtooth            11.Granite Ogre   12.Lava Jaw')
    print('13:Banshee              14.Frost Giant    15.Petrified Titan')
    print('16:Venom Dweller        17.Lightning C.   18.Storm Drake')
    print('19.Venge Wyrm')
    troop = int(input('\nEnter TROOP you want to Revive(number):'))
    print(40 * '=')
    print('Coords to attack:\n')
    coordx = int(input('Enter X coord(Coo):'))
    coordy = int(input('Enter Y coord(Coo):'))
    while blue_ene <= 0 or blue_ene % 15 != 0:
        if bluecheck > 1:
            print('You have entered invalied number for BE\n')
            print(39 * '=')
        blue_ene = int(input('\nEnter your Blue Energy Amount:'))
        bluecheck = bluecheck + 1
        if bluecheck == 10:
            print('BE must give round number when divided by 15!! Ex: 6 750 000/15=450 000')
            sys.exit()
            continue
        build = int(input('Enter No. of  BATCHES to do:'))
        print(79 * '=')
        if troop == 1:
            Ttype = 'ArcticLeviathan'
            number = round(blue_ene / 15)
            name = 'Arctic Leviathan'
            power = 15
        if troop == 2:
            Ttype = 'BattleDragon'
            number = round(blue_ene / 10)
            name = 'Battle Dragon'
            power = 7
        if troop == 3:
            Ttype = 'DragonRider'
            number = round(blue_ene / 15)
            name = 'Dragon Rider'
            power = 75
        if troop == 4:
            Ttype = 'DesertTroop'
            number = round(blue_ene / 15)
            name = 'Sand Strider'
            power = 10
        if troop == 5:
            Ttype = 'FireMirror'
            number = round(blue_ene / 10)
            name = 'Fire Mirror'
            power = 10
        if troop == 6:
            Ttype = 'Giant'
            number = round(blue_ene / 10)
            name = Ttype
            power = 9
        if troop == 7:
            Ttype = 'PackDragon'
            number = round(blue_ene / 15)
            name = 'Pack Dragon'
            power = 6
        if troop == 8:
            Ttype = 'DimensionalRuiner'
            number = round(blue_ene / 15)
            name = 'Dimensional Ruiner'
            power = 35
        if troop == 9:
            Ttype = 'IceTroop'
            number = round(blue_ene / 15)
            name = 'Soul Reaper'
            power = 10
        if troop == 10:
            Ttype = 'AquaTroop'
            number = round(blue_ene / 15)
            name = 'Fangtooth'
            power = 10
        if troop == 11:
            Ttype = 'StoneTroop'
            number = round(blue_ene / 15)
            name = 'Granite Ogre'
            power = 9
        if troop == 12:
            Ttype = 'FireTroop'
            number = round(blue_ene / 15)
            name = 'Lava Jaw'
            power = 8
        if troop == 13:
            Ttype = 'WindTroop'
            number = round(blue_ene / 15)
            name = 'Banshee'
            power = 6
        if troop == 14:
            Ttype = 'FrostGiant'
            number = round(blue_ene / 15)
            name = 'Frost Giant'
            power = 8
        if troop == 15:
            Ttype = 'ForestTroop'
            number = round(blue_ene / 15)
            name = 'Petrified Titan'
            power = 20
        if troop == 16:
            Ttype = 'SwampTroop'
            number = round(blue_ene / 15)
            name = 'Venom Dweller'
            power = 9
        if troop == 17:
            Ttype = 'LightningCannon'
            number = round(blue_ene / 15)
            name = 'Lightning Cannon'
            power = 10
        if troop == 18:
            Ttype = 'ChargeTroop'
            number = round(blue_ene / 15)
            name = 'Storm Drake'
            power = 10
        if troop == 19:
            Ttype = 'VengeWyrm'
            number = round(blue_ene / 15)
            name = 'Venge Wyrm'
            power = 10
        generals = list()
        params = 'dragon%%5Fheart=%s&timestamp=%d&version=overarch&%%5Fsession%%5Fid=%s&user%%5Fid=%d' % (dragon_heart, int(time.time()), session_id, user_id)
        url = 'http://%s/api/cities/%s.json' % (realm, capital_id)
        jsonData = myajax(realm, url, params, cookie)
        for x in range(0, len(jsonData['city']['generals'])):
            generals.insert(x, jsonData['city']['generals'][x]['id'])
     
    general1 = generals[6]
    general2 = generals[1]
    general3 = generals[2]
    print('\nITEMS TO BE USED:')
    if not input('\nEnter No. of Dark Testronius Infusions to use: '):
        pass
    infu = int(0)
    if not input('Enter No. of Dark Testronius Deluxes to use: '):
        pass
    deluxe = int(0)
    if not input('Enter No. of Jumps (1h) to use: '):
        pass
    jump = int(0)
    if not input('Enter No. of Leaps (2.5h) to use: '):
        pass
    leap = int(0)
    if not input('Enter No. of Bounces (8h) to use: '):
        pass
    bounce = int(0)
    if not input('Enter No. of Bores (15h) to use: '):
        pass
    bore = int(0)
    if not input('Enter No. of Bolts (24h) to use: '):
        pass
    bolt = int(0)
    if not input('Enter No. of Blast (2.5d) to use: '):
        pass
    blast = int(0)
    if not input('Enter No. of Blitzes (4d) to use: '):
        pass
    blitz = int(0)
    print('\n')
    print(79 * '=')
    all = jump + leap * 2.5 + bounce * 8 + bore * 15 + bolt * 24 + blast * 60 + blitz * 96
    minonumber = number + 250000
    input('\nPress ENTER to start...')
    header = 'AUTO TRANSFORMING'
    clear_screen(header)
    start_time = time.time()
    for x in range(0, build):
        print('\n')
        print(79 * '=')
        print('\nSending Attack')
        print('==============')
        t = time.time()
        realm = 'realm%d.c%d.castle.rykaiju.com' % (realm_number, c)
        params = 'user%5Fid={0}&dragon%5Fheart={1}&march%5Bx%5D={2}&march%5Bmarch%5Ftype%5D=attack&timestamp={3}&%5Fsession%5Fid={4}&march%5Bgeneral%5Fid%5D={5}&march%5Bunits%5D=%7B%22{6}%22%3A1%2C%22Minotaur%22%3A{7}%7D&%5Fmethod=post&march%5By%5D={8}&version=overarch'.format(user_id, dragon_heart, coordx, int(time.time()), session_id, general1, Ttype, minonumber, coordy)
        url = 'http://realm{}.c{}.castle.rykaiju.com/api/cities/{}/marches.json'.format(realm_number, c, locationcap)
        cadena = 'Draoumculiasis' + params + 'LandCrocodile' + url + 'Bevar-Asp'
        cadenau = cadena.encode('utf8')
        m = hashlib.sha1(cadenau)
        xs3 = m.hexdigest()
        headers = {
            'Host': realm,
            'Connection': 'keep-alive',
            'Content-Length': len(params),
            'Origin': 'http://castlemania-production.s3.amazonaws.com',
            'x-s3-aws': xs3,
            'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11',
            'content-type': 'application/x-www-form-urlencoded',
            'Accept': '*/*',
            'Accept-Encoding': 'gzip,deflate,sdch',
            'Accept-Language': 'es-ES,es;q=0.8',
            'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
            'DNT': 1,
            'Cookie': cookie }
        conn = http.client.HTTPConnection(realm, 80)
        conn.request('POST', url, params, headers)
        time.sleep(0.5)
        response = conn.getresponse()
        responseData = response.read().decode('utf-8')
        items = json.loads(responseData)
        Duration = items['result']['job']['duration']
        print('\nWaiting for attack to hit.')
        time.sleep(Duration)
        print('\nWaiting for Spectral outpost to update')
        time.sleep(15)
        checkup = 0
        while checkup == 0:
     
            try:
                params = '{0}&%5Fmethod={1}'.format(stdparams, 'put')
                url = 'http://%s/api/cities/%s.json' % (realm, capital_id)
                jsondata = myajax(realm, url, params, cookie)
                checkup = len(jsondata['city']['souls'])
            continue
            continue
            continue
     
        datat = jsondata['city']['souls'][Ttype]
        datat = int(datat)
        if checkup > 1:
            datam = jsondata['city']['souls']['Minotaur']
            datam = int(datam)
        build1 = int(datat / number)
        datatr = int(datat - build1 * number)
        Ex = 0
        if build1 < 1:
            if datat > 1 * number:
                build1 = 1
            if datat > 2 * number:
                build1 = 2
            if datat > 3 * number:
                build1 = 3
     
        print('\nAuto Reviving')
        print('=============')
        for kj in range(0, build1):
            while job_id == 0:
     
                try:
                    time.sleep(4)
                    realm = 'realm%d.c%d.castle.rykaiju.com' % (realm_number, c)
                    params = 'user%5Fid={}&dragon%5Fheart={}&timestamp={}&%5Fsession%5Fid={}&units%5Bunit%5Ftype%5D={}&units%5Bquantity%5D={}&%5Fmethod=post&version=overarch'.format(user_id, dragon_heart, int(time.time()), session_id, Ttype, number)
                    url = 'http://realm{0}.c{1}.castle.rykaiju.com/api/cities/{2}/units/resurrect.json'.format(realm_number, c, location)
                    cadena = 'Draoumculiasis' + params + 'LandCrocodile' + url + 'Bevar-Asp'
                    cadenau = cadena.encode('utf8')
                    m = hashlib.sha1(cadenau)
                    xs3 = m.hexdigest()
                    headers = {
                        'Host': realm,
                        'Connection': 'keep-alive',
                        'Content-Length': len(params),
                        'Origin': 'http://castlemania-production.s3.amazonaws.com',
                        'x-s3-aws': xs3,
                        'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11',
                        'content-type': 'application/x-www-form-urlencoded',
                        'Accept': '*/*',
                        'Accept-Encoding': 'gzip,deflate,sdch',
                        'Accept-Language': 'es-ES,es;q=0.8',
                        'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
                        'DNT': 1,
                        'Cookie': cookie }
                    conn = http.client.HTTPConnection(realm, 80)
                    conn.request('POST', url, params, headers)
                    response = conn.getresponse()
                    responseData = response.read().decode('utf-8')
                    items = json.loads(responseData)
                    idValue = items['result']['job']['id']
                    job_id = idValue
                    runat = items['result']['job']['run_at']
                    timestamp = items['timestamp']
                continue
                continue
                continue
     
            print('\nReviving: ', number, ' ', Ttype, '\n')
            Atestro = 0
            testro = 0
            timeleft = (runat - timestamp) / 3600
            while timeleft > all:
                timeleft = timeleft * 0.7
                Atestro = Atestro + 1
                time.sleep(0.1)
            testro = Atestro - infu * 13 - deluxe * 2
            if testro < 0:
                testro = 0
            objects = [
                {
                    'object': 'DarkTestroniusInfusion',
                    'quantity': infu },
                {
                    'object': 'DarkTestroniusDeluxe',
                    'quantity': deluxe },
                {
                    'object': 'DarkTestroniusPowder',
                    'quantity': testro },
                {
                    'object': 'Blitz',
                    'quantity': blitz },
                {
                    'object': 'Blast',
                    'quantity': blast },
                {
                    'object': 'Bolt',
                    'quantity': bolt },
                {
                    'object': 'Bore',
                    'quantity': bore },
                {
                    'object': 'Bounce',
                    'quantity': bounce },
                {
                    'object': 'Leap',
                    'quantity': leap },
                {
                    'object': 'Jump',
                    'quantity': jump }]
            time.sleep(5)
            for obj in objects:
                item = obj['object']
                qty = obj['quantity']
                if qty != 0:
                    qtyNo = 0
                    while qtyNo != qty:
     
                        try:
                            time.sleep(1)
                            params = '{0}&job%5Fid={1}&timestamp={2}&%5Fmethod={3}'.format(stdparams, job_id, int(time.time()), 'delete')
                            url = 'http://%s/api/player_items/%s.json' % (realm, item)
                            jsondata = myajax(realm, url, params, cookie)
                            result = jsondata['result']['success']
                            print('Using: ', item)
                            qtyNo = qtyNo + 1
                            safety = 'DarkTestroniusPowder'
                            if safety == item:
                                runat = jsondata['result']['item_response']['run_at']
                                timestamp = jsondata['timestamp']
                                timeleft = (runat - timestamp) / 3600
                                if timeleft > all:
                                    qtyNo = qtyNo - 1
                                if timeleft < all:
                                    qtyNo = qty
     
                            time.sleep(0.5)
                        continue
                        continue
                        continue
     
                    continue
            time.sleep(2)
            job_id = 0
            built = built + 1
            build1 = 0
            kj = 0
     
        if checkup > 1:
            time.sleep(3)
            time.sleep(1)
            realm = 'realm%d.c%d.castle.rykaiju.com' % (realm_number, c)
            params = 'user%5Fid={0}&dragon%5Fheart={1}&units%5Bquantity%5D={2}&timestamp={3}&%5Fsession%5Fid={4}&units%5Bunit%5Ftype%5D=Minotaur&%5Fmethod=delete&version=overarch'.format(user_id, dragon_heart, datam, int(time.time()), session_id)
            url = 'http://realm{0}.c{1}.castle.rykaiju.com/api/cities/{2}/units/release.json'.format(realm_number, c, capital_id)
            cadena = 'Draoumculiasis' + params + 'LandCrocodile' + url + 'Bevar-Asp'
            cadenau = cadena.encode('utf8')
            m = hashlib.sha1(cadenau)
            xs3 = m.hexdigest()
            headers = {
                'Host': realm,
                'Connection': 'keep-alive',
                'Content-Length': len(params),
                'Origin': 'http://castlemania-production.s3.amazonaws.com',
                'x-s3-aws': xs3,
                'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11',
                'content-type': 'application/x-www-form-urlencoded',
                'Accept': '*/*',
                'Accept-Encoding': 'gzip,deflate,sdch',
                'Accept-Language': 'es-ES,es;q=0.8',
                'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
                'DNT': 1,
                'Cookie': cookie }
            conn = http.client.HTTPConnection(realm, 80)
            conn.request('POST', url, params, headers)
            print('\nReleasing remaining mino')
        time.sleep(1)
        realm = 'realm%d.c%d.castle.rykaiju.com' % (realm_number, c)
        params = 'user%5Fid={0}&dragon%5Fheart={1}&units%5Bquantity%5D={2}&timestamp={3}&%5Fsession%5Fid={4}&units%5Bunit%5Ftype%5D={5}&%5Fmethod=delete&version=overarch'.format(user_id, dragon_heart, datatr, int(time.time()), session_id, Ttype)
        url = 'http://realm{0}.c{1}.castle.rykaiju.com/api/cities/{2}/units/release.json'.format(realm_number, c, capital_id)
        cadena = 'Draoumculiasis' + params + 'LandCrocodile' + url + 'Bevar-Asp'
        cadenau = cadena.encode('utf8')
        m = hashlib.sha1(cadenau)
        xs3 = m.hexdigest()
        headers = {
            'Host': realm,
            'Connection': 'keep-alive',
            'Content-Length': len(params),
            'Origin': 'http://castlemania-production.s3.amazonaws.com',
            'x-s3-aws': xs3,
            'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11',
            'content-type': 'application/x-www-form-urlencoded',
            'Accept': '*/*',
            'Accept-Encoding': 'gzip,deflate,sdch',
            'Accept-Language': 'es-ES,es;q=0.8',
            'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
            'DNT': 1,
            'Cookie': cookie }
        conn = http.client.HTTPConnection(realm, 80)
        conn.request('POST', url, params, headers)
        print('\nReleasing remaining: ', name)
        print('\nNumber of BATCHES done: ', built)
        print('***********************\nItems used:')
        print('===========')
        if testro != 0:
            print('Dark Testronius Powder: ', testro * built)
        if deluxe != 0:
            print('Dark Testronius Deluxe: ', deluxe * built)
        if infu != 0:
            print('Dark Testronius Infusion: ', infu * built)
        if jump != 0:
            print('Jump: ', jump * built)
        if leap != 0:
            print('Leap: ', leap * built)
        if bounce != 0:
            print('Bounce: ', bounce * built)
        if bore != 0:
            print('Bore: ', bore * built)
        if bolt != 0:
            print('Bolt: ', boltbr)
        if blast != 0:
            print('Blast: ', blast * built)
        if blitz != 0:
            print('Blitz: ', blitz * built)
        if build > 1 and build != built:
            print('\nWaiting for generals...')
            time.sleep(10)
        time.sleep(Duration)
     
    totalpower = number * built * power
    elapsed_time = time.time() - start_time
    print(79 * '=')
    print('\nElapsed time: {0}'.format(time.strftime('%H:%M:%S', time.gmtime(elapsed_time))))
    print('\n\nRevived {0} of {1} in total power of {2}'.format(format(number * built, ',d'), name, format(totalpower, ',d')))
    print('\nReviving completed!!\n')
    print(79 * '=')
    input('Press Enter to Exit...')
    Nom : Screenshot_1.jpg
Affichages : 198
Taille : 91,6 Ko

    Merci d'avance pour votre aide.

    Bien à vous,
    HighBoy

  2. #2
    Expert éminent
    Homme Profil pro
    Architecte technique retraité
    Inscrit en
    Juin 2008
    Messages
    21 741
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Manche (Basse Normandie)

    Informations professionnelles :
    Activité : Architecte technique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2008
    Messages : 21 741
    Par défaut
    Salut,

    Pourquoi écrire "continue" trois fois: Python n'est pas sourd!
    De toutes façons, au même niveau que "try:", vous n'avez droit qu'à des blocs "except:" (ou "finally:") et préciser l'exception qu'on attrape.
    Et vous avez la même séquence de 3 x continue dans d'autres blocs "try:...".
    Peut être que la lecture du Python tutorial sur le traitement des erreurs et exceptions serait utile.

    - W
    Architectures post-modernes.
    Python sur DVP c'est aussi des FAQs, des cours et tutoriels

  3. #3
    Nouveau membre du Club
    Homme Profil pro
    Webmaster
    Inscrit en
    Décembre 2015
    Messages
    5
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : Belgique

    Informations professionnelles :
    Activité : Webmaster

    Informations forums :
    Inscription : Décembre 2015
    Messages : 5
    Par défaut
    Citation Envoyé par wiztricks Voir le message
    Salut,

    Pourquoi écrire "continue" trois fois: Python n'est pas sourd!
    De toutes façons, au même niveau que "try:", vous n'avez droit qu'à des blocs "except:" (ou "finally:") et préciser l'exception qu'on attrape.
    Et vous avez la même séquence de 3 x continue dans d'autres blocs "try:...".
    Peut être que la lecture du Python tutorial sur le traitement des erreurs et exceptions serait utile.

    - W
    Merci pour votre réponse, mais je n'avais aucun problème avant.

    J'ai donc corrigé chaque endroit ou j'avais mis 3 fois "continue", mais le problème persiste.

  4. #4
    Expert éminent
    Homme Profil pro
    Architecte technique retraité
    Inscrit en
    Juin 2008
    Messages
    21 741
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Manche (Basse Normandie)

    Informations professionnelles :
    Activité : Architecte technique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2008
    Messages : 21 741
    Par défaut
    Citation Envoyé par HighBoy Voir le message
    J'ai donc corrigé chaque endroit ou j'avais mis 3 fois "continue", mais le problème persiste.
    J'ose espérer que vous ne vous êtes pas contenté de n'en mettre qu'un et que vous avez pris le temps de lire le tuto. pour comprendre quoi mettre à la place.

    - W
    Architectures post-modernes.
    Python sur DVP c'est aussi des FAQs, des cours et tutoriels

  5. #5
    Nouveau membre du Club
    Homme Profil pro
    Webmaster
    Inscrit en
    Décembre 2015
    Messages
    5
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : Belgique

    Informations professionnelles :
    Activité : Webmaster

    Informations forums :
    Inscription : Décembre 2015
    Messages : 5
    Par défaut
    Citation Envoyé par wiztricks Voir le message
    J'ose espérer que vous ne vous êtes pas contenté de n'en mettre qu'un et que vous avez pris le temps de lire le tuto. pour comprendre quoi mettre à la place.

    - W
    Bah disons que oui, parce que la je suis complètement perdu.

    Je n'avais aucun problème, il fonctionnait parfaitement depuis 2 semaines et la depuis ce matin, je rencontre un problème que je n'ai à priori jamais rencontré.

  6. #6
    Expert éminent
    Homme Profil pro
    Architecte technique retraité
    Inscrit en
    Juin 2008
    Messages
    21 741
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Manche (Basse Normandie)

    Informations professionnelles :
    Activité : Architecte technique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2008
    Messages : 21 741
    Par défaut
    Citation Envoyé par HighBoy Voir le message
    Bah disons que oui, parce que la je suis complètement perdu.
    Eh bien prenez le temps de relire le tuto.

    Citation Envoyé par HighBoy Voir le message
    Je n'avais aucun problème, il fonctionnait parfaitement depuis 2 semaines et la depuis ce matin, je rencontre un problème que je n'ai à priori jamais rencontré.
    Tel que c'est écrit, çà ne peut pas fonctionner.
    En admettant que les 3 lignes de "continue" sont apparues après une erreur de manip. impossible de savoir ce qu'il y avait avant: il faut se prendre la tête à comprendre la logique du programme.

    Si ces "continue" font planter l'interpréteur lorsqu'il lit le programme, rien ne dit qu'il n'y a pas d'autres gags qui seront détectés bien après.
    Si vous avez fait une sauvegarde ou une copie de ce script, il est temps de la retrouver.

    Bon courage.

    - W
    Architectures post-modernes.
    Python sur DVP c'est aussi des FAQs, des cours et tutoriels

Discussions similaires

  1. Problème de syntaxe - elements['x'].value
    Par Equus dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 22/02/2005, 11h22
  2. [Interbase] Problème de syntaxe SQL
    Par navis84 dans le forum InterBase
    Réponses: 4
    Dernier message: 22/12/2004, 17h07
  3. Problème de syntaxe
    Par Mister_FX dans le forum ASP
    Réponses: 5
    Dernier message: 30/06/2004, 10h01
  4. Problème de syntaxe ADO ...
    Par bendev dans le forum ASP
    Réponses: 2
    Dernier message: 15/04/2004, 14h38
  5. Réponses: 2
    Dernier message: 08/03/2004, 15h10

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo