need help, pyhon, url, var, post, error, socket

This is the place for queries that don't fit in any of the other categories.

need help, pyhon, url, var, post, error, socket

Postby Mr. Scanner » Sun Apr 07, 2013 11:59 am

import urllib
import urllib2
import os
import time

my_server = '#mywebsitehere'

def postSmallData(data):
postthis = "/uURLvar.php?upload="+urllib.quote(str(data))
conn = httplib.HTTPConnection(my_server)
conn.request("POST", postthis)

def ss2(string,BlockLength):
start = 0
end = BlockLength
loop = True
p = 0
while loop:
start += BlockLength
end += BlockLength
#a delayer , thought may get the job done :(
p += 1
if p == 160:#for server to wait
p = 0
if start > len(string): loop = False

a = open('largefile.7z','rb').read().encode('hex')
ss2(a, 4000)#this post data to php 4000 byte one post

#it works only for small bytes ~12kb max i think

#when i post something larger ex: 600kb, get an socket error, WHAT TO DO?
#i want to use URL var post as an file uploader with php.
#any recomandation?
Mr. Scanner
Posts: 1
Joined: Sun Apr 07, 2013 11:48 am

Re: need help, pyhon, url, var, post, error, socket

Postby Yoriz » Sun Apr 07, 2013 2:27 pm


Please could you edit your code to include code tags so the indention is correct.
Please read the following link on how to ask questions/post your code.
New Users, Read This
Join the #python-forum IRC channel on!
User avatar
Posts: 1629
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

Return to General Coding Help

Who is online

Users browsing this forum: snippsat, ujjwalrathod007 and 4 guests