AdPushUp ads.txt management API.
Project description
This library provides adpushup API for handling ads.txt management.
Django:
-
add it to installed apps:
INSTALLED_APPS = ( ..., 'adpushup_adstxt', ..., )
-
add your user_id and key to YOUR settings.py:
ADPUSHUP_API_USER_ID = 'test@example.com' ADPUSHUP_API_KEY = '1234'
-
OPTIONALLY add different WWW_DIR:
ADPUSHUP_WWW_DIR = '/some/dir/to/put/ads.txt/in/it/'
by default it is Djangos
ROOT_DIR + '/www'
-
ADD it to your urlconf:
from adpushup_adstxt.django_views import handle urlpatterns += patterns( '', url(r'^adsTxtManagementApiByAdpushup.php', handle)),
Testing:
from adpushup_adstxt.utils import encode_uri_component
import time
import hmac
import hashlib
import requests
user_id = 'your user id'
key = 'your key'
req_time = int(time.time())
hash_params = "email={}&ts={}".format(
encode_uri_component(user_id.encode("UTF-8")), req_time)
hash = hmac.new(key, hash_params, hashlib.sha256).hexdigest()
res = requests.post(
'http://localhost:8000/adsTxtManagementApiByAdpushup.php',
dict(
data='test content',
ts=req_time,
hash=hash))
print res.status_code
print res.content
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
adpushup-adstxt-0.1.2.tar.gz
(4.4 kB
view hashes)
Built Distribution
Close
Hashes for adpushup_adstxt-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c487434fd87f3ceb6bade363962ea4059d1e1ff4fb42706d8b8bee50f22472e |
|
MD5 | cd7089c1371e9c2d6d5cca3e80ae11f5 |
|
BLAKE2b-256 | ec098007cb624eb62d110720deda58d08ec245dfd0cd9a1057127abe6c7741a9 |