Skip to main content

AdPushUp ads.txt management API.

Project description

This library provides adpushup API for handling ads.txt management.

Django:

  1. add it to installed apps:

    INSTALLED_APPS = (
        ...,
        'adpushup_adstxt',
        ...,
        )
    
  2. add your user_id and key to YOUR settings.py:

    ADPUSHUP_API_USER_ID = 'test@example.com'
    ADPUSHUP_API_KEY = '1234'
    
  3. OPTIONALLY add different WWW_DIR:

    ADPUSHUP_WWW_DIR = '/some/dir/to/put/ads.txt/in/it/'
    

    by default it is Djangos ROOT_DIR + '/www'

  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for adpushup-adstxt, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size adpushup_adstxt-0.1.2-py3-none-any.whl (5.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size adpushup-adstxt-0.1.2.tar.gz (4.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page