# How to use as a Library?

**URL:** https://discourse.mitmproxy.org/t/how-to-use-as-a-library/240
**Category:** help
**Created:** [November 21, 2016, 2:29pm UTC](https://discourse.mitmproxy.org/t/how-to-use-as-a-library/240 "2016-11-21T14:29:21Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![ja8zyjits](https://avatars.discourse-cdn.com/v4/letter/j/958977/32.png) [@ja8zyjits](https://discourse.mitmproxy.org/u/ja8zyjits)
#### Post date: [November 21, 2016, 2:29pm UTC](https://discourse.mitmproxy.org/t/how-to-use-as-a-library/240/1 "2016-11-21T14:29:21Z")

</div>

Hi,

How can i use Mitproxy as a library?  
say i want the library to be imported, change the proxy settings like port number, forward it through another proxy etc and then run this new script which will in turn act as a proxy server. Like how we do with a web framework.

Thanks for the support.

---

<div class="post-metadata">

### Author: ![ja8zyjits](https://avatars.discourse-cdn.com/v4/letter/j/958977/32.png) [@ja8zyjits](https://discourse.mitmproxy.org/u/ja8zyjits)
#### Post date: [November 22, 2016, 11:51am UTC](https://discourse.mitmproxy.org/t/how-to-use-as-a-library/240/2 "2016-11-22T11:51:22Z")

</div>

I just explored the `examples` sections, there are a quite few of utility scripts.  
How can i delete this thread?

---

<div class="post-metadata">

### Author: ![mhils](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/mhils/32/7_2.png) [@mhils](https://discourse.mitmproxy.org/u/mhils)
#### Post date: [November 28, 2016, 2:21pm UTC](https://discourse.mitmproxy.org/t/how-to-use-as-a-library/240/3 "2016-11-28T14:21:46Z")

</div>

This is fine, no need to delete anything. 🙂

---

<div class="post-metadata">

### Author: ![Strikersb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/strikersb/32/90_2.png) [@Strikersb](https://discourse.mitmproxy.org/u/Strikersb)
#### Post date: [December 26, 2016, 4:31pm UTC](https://discourse.mitmproxy.org/t/how-to-use-as-a-library/240/4 "2016-12-26T16:31:23Z")

</div>

I also need it. if you found it,please tell me,thanks. 😆

---

<div class="post-metadata">

### Author: ![ja8zyjits](https://avatars.discourse-cdn.com/v4/letter/j/958977/32.png) [@ja8zyjits](https://discourse.mitmproxy.org/u/ja8zyjits)
#### Post date: [December 26, 2016, 4:50pm UTC](https://discourse.mitmproxy.org/t/how-to-use-as-a-library/240/5 "2016-12-26T16:50:17Z")

</div>

Check the examples like the one with a heading of “upstream server” there  
are lot of good examples. 👍
