CY5's Profile User Rating: *----

Reputation: 12 Tradesman
Group:
Active Members
Active Posts:
343 (0.51 per day)
Joined:
28-September 12
Profile Views:
5,723
Last Active:
User is offline Yesterday, 12:04 PM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
0

Latest Visitors

Icon   CY5 has not set their status

Posts I've Made

  1. In Topic: Feel free to comment on my portrait retouching

    Posted 28 Jul 2014

    I agree with @ge∅, but good try @JoshMayer
  2. In Topic: Request a PHP Tutorial

    Posted 13 Jul 2014

    anyone would POST MVC with url Routing Tutorial in php would be nice.
  3. In Topic: Python 2 to Python 3: How To Parse Load & Parse Json?

    Posted 2 Jul 2014

    ValueError: unknown url type: 'locu_url'
    

    req = urllib.request.Request('locu_url')
    


    As in the Error it shows that you have entered wrong url, remove single quotes around locu_url so it should look now as

    req = urllib.request.Request(locu_url)
    


    While exceuting your code i get Exception as
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
    urllib.error.HTTPError: HTTP Error 401: UNAUTHORIZED

    This is probably because of security feature which blocks down spider/bot user agents.

    But you can catch Exception and call .read() on that and one more thing, i got the json in byte format so i converted it to string after .read() you can see decode("utf-8")

    
    import urllib.request
    import urllib.response
    from urllib.error import HTTPError
    import json
    
    locu_api = "0a8cf7b246c4d296f04ac13ae4b8b41022bf333443"
    locu_url = 'https://api.locu.com/v1_0/venue/search/?region=space&api_key=0a8cf7b246c4d296f04ac13ae4b8b41022bf333443'
    
    req = urllib.request.Request(locu_url)
    try:
        response = urllib.request.urlopen(req).read().decode("utf-8")
    except HTTPError as e:
        venue=e.read().decode("utf-8")
        
    
    json_data=json.loads(venue)
    
    print(json_data)
    
    
    
  4. In Topic: How to read file using JSON in python

    Posted 9 Jun 2014

    Hi, Friends Please help me out with above question
  5. In Topic: how to print default values in dictonary

    Posted 7 Jun 2014

    How to call a function inside another function in class, like i am calling a Test_input() inside Student_Add() i get error as NameError: global name 'Test_input' is not defined

    class Menuinterface:
    
    	def display(self):
    		print("Student\t	Staff	\tSubject\t	Teaches")
    		print("1.Add\t 	4.Add\t 	7.Add\t 	A.Assign")
    		print("2.Remove\t5.Remove\t8.Remove\tB.unAssign")
    		print("3.View\t 	6.View\t 	9.View\t 	C.View")
    
    	def Test_input():
    		ch=input("\nDo you wish to continue(Y|N):\t")
    		if ch=='N':
    			return 'break it'
    		elif ch!='N' and ch!='Y':
    			print("\t----Input invalid----\t")
    			return False
    		elif ch=='Y':
    			return True
    
    	def Student_Add():
    		flag=True
    		while True:
    			if flag==True:
    				id=input("\nEnter Student ID:\t")
    				name=input("\nEnter Student Name:\t")	
    				flag=Test_input()
    				if flag=='break it':
    					break
    
           	getchoice={
    		'1':Student_Add
            }
         
            
    if __name__=='__main__':
    	mi=Menuinterface()
    	mi.display()
    	choice=input("You're Choice:\t")
    	if choice in mi.getchoice:
    		mi.getchoice[choice]()
    	else:
    		print("Invalid input")
    
    

My Information

Member Title:
D.I.C Regular
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

CY5 hasn't added any friends yet.

Comments

CY5 has no profile comments yet. Why not say hello?