amazonify er den enkleste måten å bygge Amazon affiliate linker, i Python.
Installer
Å installere `` python-amazonify``, bare løpe
`` Pip installere amazonify`` og du får den nyeste versjonen installert
automatisk.
Bruk
Bruke `` amazonify`` er virkelig enkelt. Alt du gjør er passere det URL Amazonas du hadde
liker å gjøre om til en affiliate link, og din Amazon affiliate tag.
`` `Python
>>> Fra amazonify import amazonify
>>>
>>> # Din Amazon affiliate tag:
>>> Affiliate_tag = 'rdegges-20'
>>>
>>> # Noen ikke-agent Amazon nettadresser:
>>> webadresser = [
... & Nbsp; & nbsp; & nbsp; & nbsp; 'http://www.amazon.com/Canon-21-1MP-Frame-Digital-Camera/dp/B001G5ZTLS/ref=sr_1_1?ie=UTF8&qid=1337148615&sr=8-1',
... & Nbsp; & nbsp; & nbsp; & nbsp; 'Http://www.amazon.com/Transcend-Compact-Flash-Card-400X/dp/B002WE4H8I/ref=pd_bxgy_p_img_b',
... & Nbsp; & nbsp; & nbsp; & nbsp; 'Http://www.amazon.com/Canon-LP-E6-Battery-Digital-Cameras/dp/B001KELVS0/ref=pd_bxgy_e_img_b',
... & Nbsp; & nbsp; & nbsp; & nbsp; 'http://www.amazon.com/Canon-50mm-1-8-Camera-Lens/dp/B00007E7JU/ref=sr_1_1?ie=UTF8&qid=1337148688&sr=8-1',
... & Nbsp; & nbsp; & nbsp; & nbsp; 'http://www.amazon.com/Canon-70-300mm-4-5-6-Lens-Cameras/dp/B0007Y794O/ref=sr_1_3?ie=UTF8&qid=1337148688&sr=8-3',
...]
>>> Affiliate_urls = [amazonify (u, tag) for u i webadresser]
>>> affiliate_urls
[
& Nbsp; & nbsp; & nbsp; 'Http://www.amazon.com/Canon-21-1MP-Frame-Digital-Camera/dp/B001G5ZTLS/ref=sr_1_1?tag=rdegges-20',
& Nbsp; & nbsp; & nbsp; 'http://www.amazon.com/Transcend-Compact-Flash-Card-400X/dp/B002WE4H8I/ref=pd_bxgy_p_img_b?tag=rdegges-20',
& Nbsp; & nbsp; & nbsp; 'http://www.amazon.com/Canon-LP-E6-Battery-Digital-Cameras/dp/B001KELVS0/ref=pd_bxgy_e_img_b?tag=rdegges-20',
& Nbsp; & nbsp; & nbsp; 'Http://www.amazon.com/Canon-50mm-1-8-Camera-Lens/dp/B00007E7JU/ref=sr_1_1?tag=rdegges-20',
& Nbsp; & nbsp; & nbsp; 'Http://www.amazon.com/Canon-70-300mm-4-5-6-Lens-Cameras/dp/B0007Y794O/ref=sr_1_3?tag=rdegges-20'
]
`` `
** MERK **: Hvis nettadressen du prøver å `` amazonify`` er ugyldig, `` amazonify`` vil returnere `` None``.
Forvirret?
Har ingen anelse om hva jeg snakker om? Se Amazons Affiliate Program.
Eller ...
Shoppe på Amazon!
Tester
Lyst til å kjøre testene? Ikke noe problem:
`` `Bash
$ Git clone git: //github.com/rdegges/python-amazonify.git
$ Cd python-amazonify
$ Python setup.py utvikle
...
$ Pip installere -r requirements.txt & nbsp; # Installer testavhengigheter.
$ nosetests
.............
-------------------------------------------------- --------------------
Ran 13 tester i 0.166s
OK
`` `
Krav :
- Python
Kommentarer ikke funnet