amazonify er den enkleste måde at opbygge Amazon affiliate links, i Python.
Installer
For at installere `` python-amazonify``, skal du blot køre
`` Pip installere amazonify`` og du får kun den nyeste version installeret
automatisk.
Anvendelse
Brug `` amazonify`` er virkelig nemt. Alt du skal gøre er give det Amazon webadresse du ville
gerne gøre til en affiliate link, og din Amazon affiliate tag.
`` `Python
>>> Fra amazonify import amazonify
>>>
>>> # Din Amazon affiliate tag:
>>> Affiliate_tag = 'rdegges-20'
>>>
>>> # Nogle ikke-affiliate Amazon webadresser:
>>> 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'
]
`` `
** BEMÆRK **: Hvis den webadresse, du forsøger at `` amazonify`` er ugyldig, `` amazonify`` vil vende tilbage `` None``.
Forvirret?
Aner ikke hvad jeg taler om? Se Amazons affiliate program.
Eller ...
Shop på Amazon!
Tests
Vil køre tests? Intet problem:
`` `Bash
$ Git klon git: //github.com/rdegges/python-amazonify.git
$ Cd python-amazonify
$ Python setup.py udvikle
...
$ Pip installere -r requirements.txt & nbsp; # Installer test afhængigheder.
$ nosetests
.............
-------------------------------------------------- --------------------
Ran 13 prøver i 0.166s
OK
`` `
Krav :
- Python
Kommentarer ikke fundet