title: How do i use django and python request to make a post request Properly
body: <p>I am  using django and python request to make a post request to this endpoint with the authorization header and body  gotten from this website. i want your assist to get this difficulty proper and to make this code work.</p>
  <pre><code>class RechargeData(models.Model, Main):
       user = models.ForeignKey(User, default=1,on_delete=models.CASCADE)
       phone_number = models.CharField(validators=[Main.phone_regex], max_length=10) 
       network = models.CharField(choices=Main.OPERATORS, max_length=15)
       plan = models.IntegerField(choices=Main.PLANS)
       amount = models.DecimalField(max_digits=10, decimal_places=2) 
  </code></pre>
  <p>i have the view.py file that contains the python request as follows</p>
  <p>import requests
  import json
  from .forms import RechargeForm</p>
  <pre><code>def rechargedata(request):
    url = &quot;http://127.0.0.1:8000/api/data/&quot;
    payload = &quot;{\&quot;network\&quot;: network_id,\n\&quot;mobile_number\&quot;: \&quot;09037346247\&quot;,\n\&quot;plan\&quot;: plan_id}&quot; 
    headers = {'Authorization': 'Token 5fd60vcdfddfxddsssfddff9a0a8742d','Content-Type': 'application/json'}
  
    response = requests.request(&quot;POST&quot;, url, headers=headers, data=payload)
  
    if request.method == &quot;POST&quot;:
        form = RechargeForm(request.POST)
        if form.is_valid():
            phone_number = form.cleaned_data['phone_number']
            network = form.cleaned_data['network']
            amount = form.cleaned_data['amount']
            plan = form.cleaned_data['plan']
        form.save
  
        context = RequestContext(request, {
            'phone_number': response.data.mobile_number,
            'network': response.data.network_id, 
            'mobile_number': response.data.network_id,
            'plan': response.data.plan_id,
            })
        return render(request, 'embeds.html', {'context': context, 'form'; form})
     else:
          form = RechargeForm()
  
     return render(request, 'index.html', { context, 'form': form})
  </code></pre>
  <p>This code is not working and am sure not to be getting something proper here.</p>
  <p>can someone help me out?</p>