# Plex networking on 0.9.5

**URL:** <https://forums.plex.tv/t/plex-networking-on-0-9-5/12759>\
**Category:** Dev/API Corner\
**Tags:** other-dev\
**Created:** [November 28, 2011, 9:38pm UTC](https://forums.plex.tv/t/plex-networking-on-0-9-5/12759 "2011-11-28T21:38:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ptath](https://avatars.discourse-cdn.com/v4/letter/p/df788c/32.png) [@ptath](https://forums.plex.tv/u/ptath)\
**Post date:** [November 28, 2011, 9:38pm UTC](https://forums.plex.tv/t/plex-networking-on-0-9-5/12759/1 "2011-11-28T21:38:07Z")

</div>

HTML.Request plz help
Seems like something changed in HTTP.Request, my plugin suddenly stops working.  
  

```auto

res = HTTP.Request(url, headers = {'User-agent': UserAgent})

```

  
  
[list=1]  
  
[\*]How to watch raw output?   
[\*]\*\*len(res)\*\* should show size of webpage in bytes? In my case \*\*len(res)\*\* returns equal results (4168, too small for webpage) for all requests =)  
[\*]Should I use \*\*HTML.ElementFromString(res)\*\* or \*\*HTML.ElementFromString(res.content)\*\* ?  
[/list]  
  
Help me plz.

---

<div class="post-metadata">

**Author:** ![sander1](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@sander1](https://forums.plex.tv/u/sander1)\
**Post date:** [November 30, 2011, 6:28pm UTC](https://forums.plex.tv/t/plex-networking-on-0-9-5/12759/2 "2011-11-30T18:28:07Z")

</div>

Hey!

> [@](#):
>
> Seems like something changed in HTTP.Request, my plugin suddenly stops working.  
>   
> 
> ```auto
> 
> res = HTTP.Request(url, headers = {'User-agent': UserAgent})
> 
> ```
> 
>   
>   
> [list=1]  
>   
> [\*]How to watch raw output?   
> [\*]\*\*len(res)\*\* should show size of webpage in bytes? In my case \*\*len(res)\*\* returns equal results (4168, too small for webpage) for all requests =)  
> [\*]Should I use \*\*HTML.ElementFromString(res)\*\* or \*\*HTML.ElementFromString(res.content)\*\* ?  
> [/list]  
>   
> Help me plz.

  
  
The line with HTTP.Request should look like this:  

```auto

res = HTTP.Request(url, headers = {'User-agent': UserAgent}).content

```

  
with \*.content\* at the end.  
  
\*len(res)\* returning 4168 could be right, because \*len()\* returns the length of a string, not the number of bytes.  
  
HTML.ElementFromString is only needed if you want to parse the HTML document as a HTML DOM, for use with Xpath for example.

---

<div class="post-metadata">

**Author:** ![ptath](https://avatars.discourse-cdn.com/v4/letter/p/df788c/32.png) [@ptath](https://forums.plex.tv/u/ptath)\
**Post date:** [November 30, 2011, 9:09pm UTC](https://forums.plex.tv/t/plex-networking-on-0-9-5/12759/3 "2011-11-30T21:09:26Z")

</div>

> [@](#):
>
> Hey!  
>   
> The line with HTTP.Request should look like this:  
> 
> ```auto
> 
> res = HTTP.Request(url, headers = {'User-agent': UserAgent}).content
> 
> ```
> 
>   
> with \*.content\* at the end.

  
  
Nope, works fine without .content =)  
  

> [@](#):
>
> \*len(res)\* returning 4168 could be right, because \*len()\* returns the length of a string, not the number of bytes.  
>   
> HTML.ElementFromString is only needed if you want to parse the HTML document as a HTML DOM, for use with Xpath for example.

  
  
I was exactly need to parse html and use with path, thanks =)  
  
BTW in my case I should use headers = {'User-agent': UserAgent, \*\*'Accept': 'text/html'\*\*}. Else it drops all html tags content =(

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [December 20, 2019, 9:28pm UTC](https://forums.plex.tv/t/plex-networking-on-0-9-5/12759/4 "2019-12-20T21:28:22Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
