Beispiel #1
0
def diveg():
  the=about.defaults()
  t=Tab(file=the.data)
  print(the.data)
  for _ in  range(10):
    print("")
    keys(t,the)
Beispiel #2
0
def eventloop(screen, div, txt, data):
    while True:
        txt.erase()
        print_dict(txt, data)
        txt.refresh()
        keys(screen)
        # refresh the windows from the bottom up
        screen.noutrefresh()
        div.noutrefresh()
        txt.noutrefresh()
        curses.doupdate
Beispiel #3
0
def process_letter(l):
    sender       = alias.get_cert(l.attributes['SENDER'],l.attributes['VIA'],False)
    receiver_pub = alias.get_cert(l.attributes['RECEIVER'],l.attributes['VIA'],False)
    receiver_prv = None

    if sender == False or receiver_pub == False:
        raise Exception("Cannot find sender or/and receiver's certificate.")

    outputbuffer = []

    jsons = splitjsons(l.body.strip())
    k = keys.keys()

    for j in jsons:
        try:
            jp = json.loads(j)
        except Exception,e:
            print 'Error decoding json: %s' % e
            continue
        try:
            if   jp['Title'] == 'Intermediate_Key':
                if receiver_prv == None:
                    receiver_prv = alias.get_cert(l.attributes['RECEIVER'],l.attributes['VIA'],True)
                    if receiver_prv == False:
                        raise Exception("Cannot find receiver's private certificate.")
                k.load(jp,sender,receiver_prv)
            elif jp['Title'] == 'Message':
                outputbuffer.append(packager.depackage(k.decrypt(jp)))
        except Exception,e:
            raise Exception("%s" % e)
Beispiel #4
0
def trends():
    twitter_keys = keys()

    # Setup access to API
    auth = tweepy.OAuthHandler(
    twitter_keys['consumer_key'],
    twitter_keys['consumer_secret'])
    auth.set_access_token(
    twitter_keys['access_token_key'],
    twitter_keys['access_token_secret'])

    api = tweepy.API(auth)

    res=api.trends_place(23424848)
    res=res[0]['trends']
    s='''
        Getting the trends by the location of India ,to get to know the latest political trends and issues and public interest.
        '''
    st.markdown(s)

    data={}

    for d in res:
        data[d['name']]=[d['name'],d['tweet_volume']]
    data=pd.DataFrame(data.values(),columns=['Name','Tweet Volume'])
    st.subheader('Trends')
    st.write('Data mined from Twitter')
    st.table(data)
Beispiel #5
0
def process_letter(l):
    sender_pub = alias.get_cert(l.attributes['SENDER'],l.attributes['VIA'],False)
    receiver   = alias.get_cert(l.attributes['RECEIVER'],l.attributes['VIA'],False)

    if sender_pub == False or receiver == False:
        raise Exception("Cannot find sender[%s] or/and receiver[%s]'s certificate." % (l.attributes['SENDER'],l.attributes['RECEIVER']))

    outputbuffer = []

    k = keys.keys()
    do_gen = False

    if not k.find_key(sender_pub,receiver):
        do_gen = True
    elif k.deprecated:
        do_gen = True
    if do_gen:

        sender_prv = alias.get_cert(l.attributes['SENDER'],l.attributes['VIA'],True)
        if sender_prv == False:
            raise Exception("Cannot find sender's private certificate.")
        newkeystr = k.new(sender_prv,receiver,432000,False)
        outputbuffer.append(newkeystr)
    elif k.activated == False and k.deprecated == False and k.exchange_info != '': # Try Key Exchange
        outputbuffer.append(json.dumps(k.exchange_info))

    trans = k.encrypt(packager.package(l.body),False)
    outputbuffer.append(trans)

    return outputbuffer
Beispiel #6
0
    def __init__(self):
        super().__init__()
        self.setupUi(self)

        self.keys = keys()
        self.request_client = RequestClient(
            api_key=self.keys.get_key(), secret_key=self.keys.get_secret_key())
        self.init_variable()
        self.main()
Beispiel #7
0
def getTestKeys():
    #We use the same password to generate keys so the client/server share keys for the test case
    testPassword = '******'
    key1 = hashlib.sha256((testPassword + '1').encode()).digest()
    key2 = hashlib.sha256((testPassword + '2').encode()).digest()
    key3 = hashlib.sha256((testPassword + '3').encode()).digest()
    key4 = hashlib.sha256((testPassword + '4').encode()).digest()
    keyStore = keys(key1, key2, key3, key4)
    return keyStore
Beispiel #8
0
    def find(self, key, value):

        """
        find all entries which 'key' equals 'value':
            - 'key' and 'value' need to have the same length
              (whatever list or tuple)
            - they can also be a single string
        all the 'value' of 'key' has to be in the ref to pick this one...
        except for 'author', for which at least one of the given author
        has to be in the ref to pick it

        """

        from keys import keys

        if type(key) is str:
            key = list({key})

        if type(value) is str:
            value = list({value})

        if len(key) != len(value):
            raise ValueError("key and value have to be lists of same length")

        items = []
        for ref in range(len(self)):

            found = False
            for i in range(len(key)):


                if key[i] == 'keyword':
                    if value[i] == '':
                        ak = keys()
                        value[i] = ak.pick()

                if type(value[i]) == str:
                    value[i] = list({value[i]})

                if key[i] == 'author':
                    for arg in value[i]:
                        if arg.lower() in self[ref]['author'].lower():
                            found = True

                else:
                    for arg in value[i]:
                        if arg.lower() in self[ref][key[i]].lower():
                            found = True

            if found is True:
                items.append(ref)

        print('')
        for ref in items:
                print('{0:24}  : {1:3}'.format(self[ref]['ID'], ref))
        print('')
Beispiel #9
0
 def __init__(self) :
     super().__init__()
     self.setupUi(self)
     self.api_key = keys()
     self.request_client = RequestClient(api_key=self.api_key.api_key(), secret_key=self.api_key.secret_key())
     # self.File_class = File_class('2020_05')
     self.init_vars()
     self.init_status_bools()
     self.init_signals_bools()
     self.init_update_threads()
     self.init_trade_threads()
def getProfile(user):
    twitter_keys = keys()

    # Setup access to API
    auth = tweepy.OAuthHandler(twitter_keys['consumer_key'],
                               twitter_keys['consumer_secret'])
    auth.set_access_token(twitter_keys['access_token_key'],
                          twitter_keys['access_token_secret'])

    s = '''
        Basic data of the user entered is shown

        ### Workflow
            An influential rate is calculated based on a statistical formula.
            The rate is calculated by the ratio of number of followers of the user to total users in india ,this accounts for 75% of the score
            The rate is also influenced by the ratio of number of followers that the users followers have

            For Eg : Getting the top 25 followers of the user and finding thier influence.
            Accounting for the influence in 1st degree of seperation .This accounts for 25% of the score
        '''
    st.markdown(s)

    api = tweepy.API(auth)

    res = api.get_user(user)
    name = '''## Name ``` %s ``` ''' % (res.name)
    location = '''## Location ``` %s ``` ''' % (res.location)
    followers = '''## Followers ``` %s ``` ''' % (str(res.followers_count))
    friends = '''## Friends ``` %s ``` ''' % (str(res.friends_count))
    verified = '''## verified ``` %s ``` ''' % (str(res.verified))
    st.markdown(name)
    st.markdown(location)
    st.markdown(followers)
    st.markdown(friends)
    st.markdown(verified)

    user_followers = res.followers_count

    res = api.friends_ids(user)

    count = 0

    for i in range(0, 25):
        user_data = api.get_user(res[i])
        count = count + user_data.followers_count

    users_num = 300000000

    influential_rate = ((user_followers / users_num) * 0.75) + (
        (count / users_num) * 0.25)
    influence = '''## Influential Rate ``` %s ``` ''' % (str(influential_rate))

    st.markdown(influence)
Beispiel #11
0
def main():


  k = keys.keys()
  c = discord.Client()


  @c.event
  async def on_ready():
    print('Ready!')
    await run(c)


  c.run(k.token)
Beispiel #12
0
    def addkey(self, identry, keylist=-1):

        """
        this method is intended to add keywords by calling the pick method
        of the 'all' keys object
        if existing, former keywords are added by default

        """


        from keys import keys

        if keylist == -1:
            ak = keys()
        else:
            raise NotImplementedError('keylist != -1 not yet implemented')

        if type(identry) == int:
            out = ak.pick(self[identry]['keyword'])

        elif type(identry) == str:
            for item in self:
                if item['ID'] == identry:
                    dic = item
                    index = self.index(item)
                    out = ak.pick(self[index]['keyword'])

        arg = ''

        for item in out:
            if arg != '':
                arg = arg + ', '
            arg = arg + item

        self.set(identry, 'keyword', arg)
        self.show(identry)
Beispiel #13
0
import numpy
import requests
from keys import keys


headers = keys().covAPI()

url = "https://covid-19-data.p.rapidapi.com/"
url_t = "https://covid-19-data.p.rapidapi.com/totals"
url_c = "https://covid-19-data.p.rapidapi.com/country"

countries = ['Afghanistan', 'Albania', 'Algeria', 'Andorra', 'Angola', 'Antigua and Barbuda', 'Argentina', 'Armenia', 'Australia', 'Austria', 'Azerbaijan', 'Bahamas', 'Bahrain', 'Bangladesh', 'Barbados', 'Belarus', 'Belgium', 'Belize', 'Benin', 'Bhutan', 'Bolivia', 'Bosnia and Herzegovina', 'Botswana', 'Brazil', 'Brunei', 'Bulgaria', 'Burkina Faso', 'Burundi', 'Cabo Verde', 'Cambodia', 'Cameroon', 'Canada', 'CAR', 'Chad', 'Chile', 'China', 'Colombia', 'Comoros', 'Congo', 'Costa Rica', "Cote d'Ivoire", 'Croatia', 'Cuba', 'Cyprus', 'Czechia', 'Denmark', 'Djibouti', 'Dominica', 'Dominican Republic', 'Ecuador', 'Egypt', 'El Salvador', 'Equatorial Guinea', 'Eritrea', 'Estonia', 'Eswatini', 'Ethiopia', 'Fiji', 'Finland', 'France', 'Gabon', 'Gambia', 'Georgia', 'Germany', 'Ghana', 'Greece', 'Grenada', 'Guatemala', 'Guinea', 'Guinea-Bissau', 'Guyana', 'Haiti', 'Honduras', 'Hungary', 'Iceland', 'India', 'Indonesia', 'Iran', 'Iraq', 'Ireland', 'Israel', 'Italy', 'Jamaica', 'Japan', 'Jordan', 'Kazakhstan', 'Kenya', 'Kiribati', 'Kuwait', 'Kyrgyzstan', 'Laos', 'Latvia', 'Lebanon', 'Lesotho', 'Liberia', 'Libya', 'Liechtenstein', 'Lithuania', 'Luxembourg', 'Madagascar', 'Malawi', 'Malaysia', 'Maldives', 'Mali', 'Malta', 'Marshall Islands', 'Mauritania', 'Mauritius', 'Mexico', 'Micronesia', 'Moldova', 'Monaco', 'Mongolia', 'Montenegro', 'Morocco', 'Mozambique', 'Myanmar', 'Namibia', 'Nauru', 'Nepal', 'Netherlands', 'New Zealand', 'Nicaragua', 'Niger', 'Nigeria', 'N. Korea', 'North Macedonia', 'Norway', 'Oman', 'Pakistan', 'Palau', 'Palestine', 'Panama', 'Papua New Guinea', 'Paraguay', 'Peru', 'Philippines', 'Poland', 'Portugal', 'Qatar', 'Romania', 'Russia', 'Rwanda', 'Saint Kitts and Nevis', 'Saint Lucia', 'Saint Vincent and the Grenadines', 'Samoa', 'San Marino', 'Sao Tome and Principe', 'Saudi Arabia', 'Senegal', 'Serbia', 'Seychelles', 'Sierra Leone', 'Singapore', 'Slovakia', 'Slovenia', 'Solomon Islands', 'Somalia', 'South Africa', 'S. Korea', 'South Sudan', 'Spain', 'Sri Lanka', 'Sudan', 'Suriname', 'Sweden', 'Switzerland', 'Syria', 'Taiwan', 'Tajikistan', 'Tanzania', 'Thailand', 'Timor-Leste', 'Togo', 'Tonga', 'Trinidad and Tobago', 'Tunisia', 'Turkey', 'Turkmenistan', 'Tuvalu', 'Uganda', 'Ukraine', 'UAE', 'UK', 'USA', 'Uruguay', 'Uzbekistan', 'Vanuatu', 'Vatican City', 'Venezuela', 'Vietnam', 'Yemen', 'Zambia', 'Zimbabwe']

querystring = querystring = {"format":"undefined","name":"Australia"}



response = requests.request("GET", url_c, headers=headers, params=querystring)

print(response.text)
Beispiel #14
0
 def __init__(self):
     key = keys()
     self.api = twitter.Api(consumer_key=key.consumer_key,
                            consumer_secret=key.consumer_secret,
                            access_token_key=key.access_token,
                            access_token_secret=key.access_token_secret)
Beispiel #15
0
 def __init__(self, endpoint, params, user=None, rcfile=None, times=1):
     self.endpoint = endpoint
     self.params = params
     self.api = T.TwitterAPI(*keys.keys(user, rcfile))
     self.times = times
     self.stop, self.cursor, self.response = self.get_first()
Beispiel #16
0
def main():

	# init the pySDL2 API
    sdl = SDL( 0, 0 )

    # print the screen res
    print(sdl.x, sdl.y)

    logic = logicMap("boxmap.csv", sdl.x, sdl.y, tileWidth, tileHeight)

    # make a camera 
    cam = camera( sdl.x, sdl.y )

    # set camera margins
    cam.margin.x = sdl.x//3
    cam.margin.y = sdl.y//3

    # create tile engine
    t = tileEngine( sdl )
    t.addTextMap( "boxmap.csv" )
    t.addTileSheet( "tileset.png" , tileWidth, tileHeight )

    # create a key set
    k = keys( sdl.setKeys( [ "up", "down", "left", "right" ] ) )

    # create a person
    side = 20

    # x, y, max_speed, acceleration, deceleration, width, height, dx=0, dy=0
    guy = person( 0., 0., 1000, 1000, 1000, side, side )

    box = aabb( 0, 0, tileWidth, tileHeight )
    boxRect = sdl.rect( box.x, box.y, tileWidth, tileHeight )

    # create an 'SDL_Rect' to render guy in
    rect = sdl.rect( guy.x, guy.y, guy.w, guy.h )

    
    sdl.setColor([0,255,0])
    
    GAME = True
    while GAME: # enter the main loop with the flag 'GAME'

        while sdl.eventLoop():   # event loop
            GAME = sdl.running() # quit if user presses 'esc' or clicks out
            k.poll( sdl.event )  # poll the keys

        # unpack the key flags
        guy.up, guy.down, guy.left, guy.right = k.unpack()

        # move guy!
        guy.move()

        # set the camera positions
        cam.move( guy.x, guy.y, guy.w, guy.h )

        logic.update(cam.x, cam.y)
           

        for i, o in enumerate( logic.register ):

            box.x, box.y = o[0]

            if o[1] > -1:

                if checkFloor( guy, box ):
                    guy.y = box.y - guy.h
                    guy.dy = 0

                if checkRoof( guy, box ):
                    guy.y = box.y + box.h
                    guy.dy = 0

                if checkLeft( guy, box ):
                    guy.x = box.x - guy.w
                    guy.dx = 0

                if checkRight( guy, box ):
                    guy.x = box.x + box.w
                    guy.dx = 0


        # set the position of the static rendering rect
        rect.x = int( guy.x  - cam.x )
        rect.y = int( guy.y  - cam.y )

        # paint the screen
        sdl.clearColor( [ 100, 0, 100 ] )

        # create layer
        t.addLayer( cam.x, cam.y, 0, 0 )

        # draw and clear the tile layers
        t.drawLayer(0)
        t.clearLayers()
        
        # draw the dude
        sdl.setColor( [ 0, 255, 255 ] )
        sdl.fillRect( rect )

        # flip the buffer!
        sdl.present()

    # destroy the window and renderer if user quits
    sdl.cleanUp()