微信公众号创建自定义菜单

2024年1月27日 19:58 by wst

公众号开发

微信自带的菜单不够灵活,项目中有时要自定义菜单。具体代码如下:

import requests
import json

from wanhuqianjia.settings import MENU_URL
from .utils import get_token, remove_token

MENU = {
    "button":[
        {   
            "type":"view",
            "name":"抖音学习",
            "key":"V1001_DOUYIN",
            "url": "https://h5.xiaoeknow.com"
        },
        {
            "type":"click",
            "name":"签约合作",
            "key":"V1002_SIGN",
            "url": "https://union.bytedance.com/open/"
        },
        {
            "type":"view",
            "name":"打卡更新",
            "key":"V1003_CONTACT",
            "url": "https://h5.xiaoeknow.com/p/course/ecourse/"
        }
    ]
}


def create_menu(menu, menu_url):
    "创建自定义菜单"
    token = get_token()
    url = menu_url + "?access_token=" + token
    data = json.dumps(menu,ensure_ascii=False).encode('utf-8')
    res = requests.post(url, data=data)
    res_data = res.json()
    if "errcode" in res_data and res_data['errcode']==40001:
        remove_token()
        res = requests.post(url, data=data)
    print("res:", res.json())

def test_menu():
    "创建菜单"
    create_menu(MENU, MENU_URL)

if __name__ == "__main__":
    test_menu()

这里列出的是主要代码,如果问题,欢迎留言!


Comments(126) Add Your Comment

Ykyybp
cheap atorvastatin 40mg <a href="https://lipiws.top/">atorvastatin pills</a> buy atorvastatin no prescription
Mdoaec
baycip sale - <a href="https://cipropro.top/keflexcapsule/">cephalexin 125mg for sale</a> buy generic clavulanate online
Wzukxw
purchase cipro for sale - <a href="https://metroagyl.top/cefaclor/">cephalexin 250mg canada</a> order augmentin 375mg sale
Bpmcqv
order flagyl 400mg without prescription - <a href="https://metroagyl.top/azithromycin/">buy azithromycin 500mg sale</a> azithromycin 500mg over the counter
Ibmdvx
ciplox 500mg us - <a href="https://septrim.top/chloromycetin/">purchase chloromycetin online cheap</a> erythromycin cost
Optmmd
buy valtrex 1000mg sale - <a href="https://gnantiviralp.com/nemasole/">buy nemasole generic</a> buy acyclovir pills for sale
Dykzzt
ivermectin 6 mg for sale - <a href="https://keflexin.top/amoxiclav/">cheap amoxiclav for sale</a> sumycin 250mg cheap
Fbwluv
order metronidazole 400mg - <a href="https://metroagyl.top/clindamycin/">cleocin sale</a> zithromax 250mg cheap
Zramxa
buy ampicillin generic <a href="https://ampiacil.top/">buy acillin generic</a> amoxicillin canada
Czflcv
furosemide where to buy - <a href="https://antipathogenc.com/minipressm/">order generic prazosin</a> captopril 25mg drug
Xaletd
purchase glucophage sale - <a href="https://gnantiacidity.com/duricef/">generic cefadroxil 500mg</a> lincomycin 500mg brand
Xesfqp
brand retrovir - <a href="https://canadiangnp.com/epivir/">buy epivir generic</a> cheap zyloprim 300mg
Zjpsju
buy clozaril generic - <a href="https://genonlinep.com/accupril/">order accupril 10mg sale</a> oral famotidine 40mg
Xizpvd
oral seroquel - <a href="https://gnkantdepres.com/zoloft/">purchase zoloft for sale</a> eskalith over the counter
Hhqmqd
order clomipramine - <a href="https://antdeponline.com/abilify/">abilify 30mg price</a> buy sinequan 25mg online cheap
Qcwikt
order hydroxyzine pills - <a href="https://antdepls.com/pamelor/">pamelor cheap</a> endep 25mg cost
Ysunnr
order augmentin pills - <a href="https://atbioinfo.com/ampicillin/">purchase ampicillin generic</a> ciprofloxacin 1000mg sale
Iyhaip
cheap amoxil sale - <a href="https://atbioxotc.com/cefadroxil/">duricef oral</a> buy ciprofloxacin 1000mg online cheap
Rgppid
buy cleocin cheap - <a href="https://cadbiot.com/">purchase cleocin online</a> buy chloromycetin generic
Tllinj
zithromax without prescription - <a href="https://gncatbp.com/emetronidazole/">oral metronidazole</a> ciprofloxacin 500mg oral
Viuuuy
buy stromectol europe - <a href="https://antibpl.com/rferyc/">order eryc online cheap</a> cefaclor 500mg pill
Xpffnx
buy albuterol generic - <a href="https://antxallergic.com/oiphenergan/">promethazine pills</a> theophylline 400 mg canada
Jxilrw
buy medrol 4mg - <a href="https://ntallegpl.com/">how to get methylprednisolone without a prescription</a> azelastine 10ml tablet
Qhrbdp
purchase clarinex generic - <a href="https://rxtallerg.com/beclomethasone/">buy beclamethasone nasal sprays</a> albuterol over the counter
Gemlxa
buy generic micronase - <a href="https://prodeprpl.com/">micronase 5mg for sale</a> cost dapagliflozin 10mg
Eerrlc
glycomet drug - <a href="https://arxdepress.com/losartan25/">buy losartan</a> buy generic acarbose online
Wikzxr
prandin 1mg tablet - <a href="https://depressinfo.com/">order repaglinide 2mg generic</a> order jardiance for sale
Ggovfy
terbinafine online buy - <a href="https://treatfungusx.com/xgrifulvinvs/">griseofulvin brand</a> grifulvin v us
Lrjpfd
buy rybelsus tablets - <a href="https://infodeppl.com/glucovance5/">order glucovance without prescription</a> DDAVP for sale online
Ndxdfo
purchase ketoconazole online - <a href="https://antifungusrp.com/">order ketoconazole for sale</a> itraconazole 100 mg sale
Zyzwic
famciclovir 500mg pills - <a href="https://amvinherpes.com/gnvalaciclovir/">buy cheap generic valcivir</a> valaciclovir 1000mg over the counter
Qyhywf
order digoxin 250 mg pill - <a href="https://blpressureok.com/avalidemed/">buy cheap generic avalide</a> furosemide 100mg brand
Tzbwqq
hydrochlorothiazide 25mg us - <a href="https://norvapril.com/lisinopril/">buy zestril 2.5mg generic</a> zebeta pills
Nleafw
buy metoprolol online - <a href="https://bloodpresspl.com/olmesartan/">buy olmesartan 10mg pill</a> nifedipine order
Dteiry
where can i buy nitroglycerin - <a href="https://nitroproxl.com/">brand nitroglycerin</a> buy valsartan online
Udkwrl
rosuvastatin pills infinite - <a href="https://antcholesterol.com/">crestor pills sneer</a> caduet sugar
Yayawd
simvastatin perish - <a href="https://canescholest.com/fenofibrate/">fenofibrate society</a> atorvastatin sentence
Rggzle
buy viagra professional drawer - <a href="https://edsildps.com/malegra/">malegra lantern</a> levitra oral jelly online wretch
Yzcpsg
dapoxetine stray - <a href="https://promedprili.com/cialiswithdapoxetine/">cialis with dapoxetine soil</a> cialis with dapoxetine happen
Dddlyx
cenforce online monkey - <a href="https://xcenforcem.com/tadalissxtadalafil/">tadalis rusty</a> brand viagra breathe
Azlypo
brand cialis even - <a href="https://probrandtad.com/forzestpills/">forzest misery</a> penisole departure
Tucxzi
cialis soft tabs pills cigarette - <a href="https://supervalip.com/cavertapills/">caverta direction</a> viagra oral jelly online relation
Yqfovj
brand cialis service - <a href="https://probrandtad.com/apcalissx/">apcalis conclusion</a> penisole baby
Slubdt
cialis soft tabs supply - <a href="https://supervalip.com/">cialis soft tabs online eagle</a> viagra oral jelly since
Mqtwft
dapoxetine hearty - <a href="https://promedprili.com/suhagra/">suhagra rich</a> cialis with dapoxetine section
Asutvs
acne treatment stretch - <a href="https://placnemedx.com/">acne medication action</a> acne treatment ear
Qikwyx
inhalers for asthma smoke - <a href="https://bsasthmaps.com/">inhalers for asthma absurd</a> inhalers for asthma shutter
Kekqjr
uti medication hit - <a href="https://amenahealthp.com/">uti treatment tom</a> treatment for uti gleam
Eyvtdb
prostatitis pills frog - <a href="https://xprosttreat.com/">prostatitis pills explosion</a> prostatitis treatment sail
Jgnjdu
valtrex online dean - <a href="https://gnantiviralp.com/">valacyclovir uniform</a> valacyclovir pills side
Eczdog
claritin pills profound - <a href="https://clatadine.top/">claritin pills gaunt</a> claritin pills plate
Htomgb
priligy drawer - <a href="https://prilixgn.top/">priligy altogether</a> dapoxetine dye
Bmxqxo
claritin pills pan - <a href="https://clatadine.top/">loratadine photograph</a> loratadine medication climb
Sseack
ascorbic acid dawn - <a href="https://ascxacid.com/">ascorbic acid soldier</a> ascorbic acid grey
Dxbofl
promethazine sweet - <a href="https://prohnrg.com/">promethazine reserve</a> promethazine collect
Pbbtmg
biaxin appeal - <a href="https://gastropls.com/mesalaminepl/">mesalamine pills elsewhere</a> cytotec ray
Dhosud
fludrocortisone pills threat - <a href="https://gastroplusp.com/omepprilosec/">omeprazole pills invite</a> prevacid resume
Vmgehb
order rabeprazole 10mg for sale - <a href="https://gastrointesl.com/domperidone/">buy domperidone online</a> buy domperidone pills
Hanpns
order bisacodyl 5 mg for sale - <a href="https://gastroinfop.com/oxybutynin/">order oxybutynin 5mg online</a> cost liv52 20mg
Elgwft
buy bactrim 480mg for sale - <a href="https://tobmycin.com/">oral tobrex 5mg</a> order tobra 5mg
Mfifja
cheap hydroquinone - <a href="https://cerazestrel.com/">buy desogestrel no prescription</a> duphaston order online
Wrxzbu
order forxiga 10mg pills - <a href="https://precarbos.com/">precose 50mg drug</a> order acarbose 25mg for sale
Ytlzla
order griseofulvin 250mg generic - <a href="https://gemfilopi.com/">purchase gemfibrozil</a> lopid 300 mg over the counter
Rdmvba
order dimenhydrinate 50mg sale - <a href="https://bisacolax.com/">buy dimenhydrinate generic</a> risedronate canada
Ocypvt
vasotec tablet - <a href="https://doxapisin.com/">buy generic doxazosin</a> order zovirax generic
Rwohxe
monograph online buy - <a href="https://etodograph.com/">monograph 600mg drug</a> cilostazol 100 mg usa
Sjjzob
purchase piroxicam generic - <a href="https://rivastilons.com/">purchase rivastigmine</a> order exelon for sale
Gcedlh
cost nootropil 800 mg - <a href="https://nootquin.com/efavirenz/">order generic sustiva 10mg</a> sinemet cost
Qsvpuy
buy hydroxyurea generic - <a href="https://hydroydrinfo.com/pentoxifylline/">order pentoxifylline online cheap</a> robaxin 500mg us
Xjmmef
where can i buy depakote - <a href="https://adepamox.com/aspirindipyridamole/">cheap aggrenox online</a> purchase topiramate generic
Kxbfmy
order norpace sale - <a href="https://anorpica.com/pregabal/">buy lyrica 150mg without prescription</a> order thorazine 100mg generic
Arsywi
cheap cyclophosphamide without prescription - <a href="https://cycloxalp.com/atomoxetine/">buy strattera</a> buy generic trimetazidine
Fgcxqf
spironolactone pill - <a href="https://aldantinep.com/phenytoin/">dilantin price</a> buy generic revia
Xsgyux
order cyclobenzaprine - <a href="https://abflequine.com/olanzapine/">cheap olanzapine</a> enalapril 10mg uk
Qsucwl
oral zofran - <a href="https://azofarininfo.com/oxybutynin/">buy oxybutynin generic</a> buy ropinirole 2mg for sale
Adpbmp
buy ascorbic acid 500 mg - <a href="https://mdacidinfo.com/ciprofloxacin/">purchase ciprodex ophthalmic solution without prescription</a> where to buy prochlorperazine without a prescription
Rvwnjq
buy durex gel sale - <a href="https://xalaplinfo.com/latanoprosteyedrops/">buy zovirax paypal</a> buy zovirax online
Jbidmj
purchase minoxidil - <a href="https://hairlossmedinfo.com/finasteridehl/">propecia for sale online</a> purchase propecia generic
Pgvxny
leflunomide pill - <a href="https://infohealthybones.com/cartidin/">cartidin without prescription</a> cartidin cost
Rhakyk
buy generic calan 240mg - <a href="https://infoheartdisea.com/valsartan/">buy valsartan 80mg pills</a> buy tenoretic generic
Xxwjfi
buy tenormin generic - <a href="https://heartmedinfox.com/carvedilol/">coreg 25mg for sale</a> buy generic carvedilol
Xoowde
buy generic atorlip - <a href="https://infoxheartmed.com/lisinopril/">lisinopril without prescription</a> bystolic usa
Edunir
cheap gasex without prescription - <a href="https://herbalinfomez.com/">purchase gasex without prescription</a> diabecon brand
Agdsrf
generic lasuna - <a href="https://infoherbalmz.com/diarex/">where can i buy diarex</a> buy himcolin sale
Ihcabx
buy norfloxacin tablets - <a href="https://gmenshth.com/confido/">order confido online cheap</a> buy confido generic
Cgsyry
speman drug - <a href="https://spmensht.com/himplasia/">buy himplasia</a> buy fincar medication
Socarz
finasteride order - <a href="https://finmenura.com/kamagra/">generic kamagra 100mg</a> alfuzosin 10 mg generic
Fxquvp
order terazosin 1mg generic - <a href="https://hymenmax.com/tamsulosin/">buy tamsulosin generic</a> priligy 90mg price
Jwvwwq
oral oxcarbazepine 300mg - <a href="https://trileoxine.com/pirfenidone/">buy pirfenex for sale</a> order synthroid 100mcg sale
Yjbtjo
how to buy imusporin - <a href="https://asimusxate.com/">buy cyclosporine eye drops for sale</a> buy colchicine 0.5mg generic
Haojpg
buy lactulose generic - <a href="https://duphalinfo.com/">buy generic lactulose online</a> buy betahistine online
Mtvoku
deflazacort canada - <a href="https://lazacort.com/">buy deflazacort pills for sale</a> buy alphagan generic
Weiwho
buy generic gabapentin online - <a href="https://aneutrin.com/ibuprofen/">how to buy ibuprofen</a> cheap azulfidine 500mg
Rbqzby
besifloxacin order online - <a href="https://besifxcist.com/sildamax/">cheap sildamax pill</a> order sildamax generic
Qbvuax
probenecid online order - <a href="https://bendoltol.com/monograph/">cost etodolac</a> tegretol 400mg canada
Vpruzg
celebrex usa - <a href="https://celespas.com/flavoxate/">flavoxate order online</a> order indomethacin 75mg without prescription
Hlxyjp
colospa 135 mg cost - <a href="https://coloxia.com/">mebeverine 135mg us</a> pletal 100 mg usa
Qmdiph
cambia without prescription - <a href="https://dicloltarin.com/aspirin/">aspirin ca</a> aspirin order online
Ubanjg
purchase pyridostigmine generic - <a href="https://mestonsx.com/asumatriptan/">cost sumatriptan 50mg</a> azathioprine 25mg for sale
Clsfor
rumalaya where to buy - <a href="https://rumaxtol.com/">rumalaya tablet</a> buy amitriptyline online cheap
Cojovz
lioresal without prescription - <a href="https://baclion.com/">purchase ozobax online cheap</a> order piroxicam 20mg online
Uctykp
periactin 4mg ca - <a href="https://periheptadn.com/">oral cyproheptadine 4 mg</a> buy tizanidine for sale
Pueezw
buy meloxicam medication - <a href="https://meloxiptan.com/">buy meloxicam 15mg without prescription</a> buy ketorolac medication
Xqkrsu
omnicef for sale - <a href="https://omnixcin.com/aminocycline/"></a> cleocin generic
Xduiid
buy generic artane - <a href="https://voltapll.com/diclofenacgel/">purchase emulgel online cheap</a> order diclofenac gel for sale
Bpzfts
isotretinoin 20mg tablet - <a href="https://aisotane.com/">order accutane online cheap</a> buy deltasone 40mg generic
Qiiigt
order prednisone 10mg - <a href="https://apreplson.com/permethrin/">oral elimite</a> order elimite generic
Qzqiqn
order permethrin sale - <a href="https://actizacs.com/asbenzac/">order benzoyl peroxide</a> purchase retin generic
Wijgdg
betamethasone order online - <a href="https://betnoson.com/awdifferin/">where to buy adapalene without a prescription</a> order monobenzone sale
Krzdmt
metronidazole for sale - <a href="https://cenforcevs.com/">cenforce price</a> buy cenforce generic
Dhpfjj
brand augmentin 625mg - <a href="https://alevonted.com/">cheap levoxyl</a> levoxyl tablets
Kwxldy
purchase hyzaar sale - <a href="https://acephacrsa.com/">keflex drug</a> buy keflex 500mg for sale
Lrpuvd
buy clindamycin pill - <a href="https://indometnp.com/">order indocin 50mg online</a> indomethacin over the counter
Gtrddv
buy generic crotamiton for sale - <a href="https://aeuracream.com/abactroban/">bactroban ointment without prescription</a> aczone tablet
Shulfe
order provigil 200mg online - <a href="https://sleepagil.com/">provigil order</a> meloset price
Djplkc
purchase bupropion without prescription - <a href="https://bupropsl.com/ayurslim/">order ayurslim generic</a> shuddha guggulu cheap
Lrbgky
xeloda 500 mg generic - <a href="https://xelocap.com/naproxen/">naprosyn 500mg uk</a> danazol pills
Kozuoo
progesterone 100mg sale - <a href="https://apromid.com/clomipheneferto/">buy clomiphene online cheap</a> cheap clomiphene online
Kiprqq
oral alendronate - <a href="https://pilaxmax.com/tamoxifen/">buy nolvadex pill</a> provera 5mg canada
Eevhjv
order norethindrone 5 mg online - <a href="https://norethgep.com/lumigan/">lumigan over the counter</a> cheap yasmin online
Cuaenq
estradiol 2mg cheap - <a href="https://festrolp.com/ginette-35/">order generic ginette 35</a> buy anastrozole 1mg sale
Iftojt
dostinex 0.25mg sale - <a href="https://adostilin.com/premarin/">premarin 0.625mg us</a> cheap alesse generic
Xesxqy
гѓ—гѓ¬гѓ‰гѓ‹гѓі её‚иІ© гЃЉгЃ™гЃ™г‚Ѓ - <a href="https://jpaonlinep.com/">гѓ—гѓ¬гѓ‰гѓ‹гѓійЂљиІ©</a> г‚ёг‚№гѓ­гѓћгѓѓг‚Ї гЃ®иіје…Ґ
Cmmxip
ばいあぐら - <a href="https://jpedpharm.com/">バイアグラ通販おすすめ</a> シアリス の購入
Vvfdxp
プレドニンジェネリック 通販 - <a href="https://jpanfarap.com/">プレドニン錠 20 mg 強さ</a> アキュテインジェネリック 通販
Yrxviv
eriacta persuade - <a href="https://eriagra.com/fforzestf/">forzest pink</a> forzest everything