> For the complete documentation index, see [llms.txt](https://offerslook-api.gitbook.io/api-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://offerslook-api.gitbook.io/api-documentation/demo_code/http_basic_authentication_python.md).

# Http Basic authentication python

## python example 1:

```python
import requests
def basic_auth_example(network_name,api_key,offer_s,update_data):
    api_url = "http://%s:%s@%s.api.offerslook.com/v1/offers/%s" %(network_name,api_key,network_name,offer_s)
    data = update_data 
    querystring = ''
    req = requests.request("PUT",api_url,data=update_data,headers={'content-type':"application/json",'cache-control': "no-cache",'postman-token': "4d5c83b4-a338-19a5-03d0-d5a81524bfac"},params=querystring)
    response = req.text
    print response

offer_id = 10001
network_name = "demo"
api_key = "8cca20a07a24a7e425835221def4066a"
update_data = '{"offer":{"lead_traffic":1}}'    #Enable offer sync click
basic_auth_example(network_name,api_key,offer_id,update_data)
```

## python example 2:

```python
import base64,json,urllib2
def basic_auth_example2(network_name,api_key,offer_s,update_data):
    api_url = "http://%s.api.offerslook.com/v1/offers/%s" %(network_name,offer_s)
    base64string = base64.encodestring('%s:%s' %(network_name,api_key))[:-1]
    authheader =  "Basic %s" %base64string
    req = urllib2.Request(api_url,data=update_data,headers={'content-type':'application/json','Authorization':authheader});
    req.get_method = lambda:'PUT';
    response = urllib2.urlopen(req);
    print response.read();

offer_id = 10001
network_name = "demo"
apikey = "8cca20a07a24a7e425835221def4066a"
dict_data = {"offer": {"lead_traffic": 1}};
data = json.dumps(dict_data);
basic_auth_example2(network_name,apikey,offer_id,data)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://offerslook-api.gitbook.io/api-documentation/demo_code/http_basic_authentication_python.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
