İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

KeyError when evaluating

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
odooHelpdeskAutomatedActionsv16
1 Cevapla
1930 Görünümler
Avatar
Nathan

Hello, I have this code


def send_WA(self, name='', cid='', ticketid='', number='', templateWA='', user='', pw=''):
        todo = {
      	    "username": user,
            "password": pw
    	}
        headers= {
    	    "Content-Type":"application/json"
    	}
        r = requests.post("API URL",json.dumps(todo),headers=headers)
        response = r.json()
        jsonString=json.dumps(response)
        jsonObject=json.loads(jsonString)
        temp_token=jsonObject['jwt']['token']
        token=json.dumps(temp_token)
        token_final=token.strip('"')
        unique_token="Bearer " + token_final
        api_url="API URL" + templateWA
        todo1 = {
      	    "param":[name,cid,ticketid],
      	    "templateName":templateWA,
      	    "smsFallback":"false",
      	    "to": [number]
      	}
        headers1 = {
      	    "Content-Type":"application/json",
      	    "Authorization":unique_token
      	}
        response1 = requests.post(api_url, json.dumps(todo1), headers=headers1)
        r1 = response1.json()
        jsonString1=json.dumps(r1)
        jsonObject1=json.loads(jsonString1)
        temp_value = jsonObject1["data"][0]["status"]
        if temp_value == "failed":
            temp_value1 = jsonObject1["data"][0]["error"]
            if temp_value1 == "(#100) Invalid parameter":
                temp_value = "Invalid Phone Number"
        value = json.dumps(temp_value)
        final_value = value.strip('"')
        return final_value
And always get this error:

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/odoo/tools/safe_eval.py", line 391, in safe_eval return unsafe_eval(c, globals_dict, locals_dict) File "ir.actions.server(606,)", line 7, in File "/opt/odoo/odoo-myrep/myrep_addon_ticketing/models/helpdesk_ticket.py", line 1236, in send_WA temp_value = jsonObject1["data"][0]["status"] KeyError: 'data'
ValueError: : "data" while evaluating
When I try to run the function manually (not from ODOO), it works and the response for jsonObject1 is as follows:

{'status': 200, 'data': [{'to': '+628********', 'messageId': '0ffb8cfb-be5d-447f-a002-*********', 'whatsappMessageId': 'wamid.HBgNNjI4OTYzNjEwNjI4MRUCABEYEj*******', 'status': 'sent'}], 'success': 1, 'failed': 0, 'msg': 'success'}

How to resolve this problem? thanks in advance


0
Avatar
Vazgeç
Avatar
Niyas Raphy (Walnut Software Solutions)
En İyi Yanıt

Hi,
I hope you know that the error is coming as data key is missing in the variable jsonObject1 , this may be due to many reasons, for example lack for proper authentication etc

What you can do to solve the issue is try to execute the same code from the postman application, see if it works from there, if yes, take the python code from the postman and using that python code try to execute from odoo.

Thanks

0
Avatar
Vazgeç
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Üye Ol
İlgili Gönderiler Cevaplar Görünümler Aktivite
Message Channel every time I validate a Receipts. Çözüldü
odoo AutomatedActions
Avatar
Avatar
1
Eyl 23
2031
How to use action = {} in automate actions, and give me some example with more explanation
odoo AutomatedActions
Avatar
0
Ara 22
3134
Automated action sends notification Çözüldü
AutomatedActions V16 v16
Avatar
Avatar
Avatar
2
Ağu 24
2608
v16: how to execute Automated Action on click of a button
button odoo AutomatedActions
Avatar
Avatar
1
Oca 24
5075
Automated Action that changes stage when customer replies
stages Helpdesk AutomatedActions
Avatar
Avatar
1
Tem 23
3488
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now