Projet

Général

Profil

Bug #49916

python 3.9 : module 'base64' has no attribute 'encodestring'

Ajouté par Thomas Noël il y a plus de 3 ans. Mis à jour il y a environ 3 ans.

Statut:
Fermé
Priorité:
Bas
Assigné à:
Version cible:
-
Début:
06 janvier 2021
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:
Non

Description

En faisant tourner les tests sur une machine trop récente (python 3.9) :

passerelle/apps/cartads_cs/models.py:199: in update_data_cache
    resp = client.service.GetCommunes(self.get_token(), {})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <CartaDSCS: Test>

    def get_token(self):
        token_data = {
            'date': datetime.datetime.now().strftime('%d/%m/%Y %H:%M:%S'),
            'login': self.username,
            'password': self.password,
        }
        if self.client_name:
            token_data['client'] = self.client_name
        token_data_str = json.dumps(token_data)
        data_pad = AES.block_size - len(token_data_str) % AES.block_size
        aes = AES.new(self.secret_key, AES.MODE_CBC, self.iv)
        token = aes.encrypt(token_data_str  + (chr(data_pad)*data_pad))
>       return force_text(base64.encodestring(token)).replace('\n', '').rstrip('=')
E       AttributeError: module 'base64' has no attribute 'encodestring'

... il faut sans doute passer par encodebytes


Fichiers

Révisions associées

Révision e8870d6b (diff)
Ajouté par Thomas Noël il y a environ 3 ans

cartads_cs: replace deprecated base64.encodestring with encodebytes (#49916)

Historique

#1

Mis à jour par Thomas Noël il y a plus de 3 ans

#2

Mis à jour par Lauréline Guérin il y a plus de 3 ans

  • Assigné à mis à Thomas Noël
#3

Mis à jour par Frédéric Péters il y a environ 3 ans

  • Statut changé de Solution proposée à Solution validée
#4

Mis à jour par Thomas Noël il y a environ 3 ans

  • Statut changé de Solution validée à Résolu (à déployer)
commit e8870d6b9708843768f2a002aab2e34d35e115c9
Author: Thomas NOEL <tnoel@entrouvert.com>
Date:   Wed Jan 6 15:12:51 2021 +0100

    cartads_cs: replace deprecated base64.encodestring with encodebytes (#49916)

#5

Mis à jour par Frédéric Péters il y a environ 3 ans

  • Statut changé de Résolu (à déployer) à Solution déployée

Formats disponibles : Atom PDF